(Note: this covers both the file and image preparation APIs)
The various prepare_file and prepare_image methods and functions currently accept the following input types:
str (filesystem path)
os.PathLike[str] (filesystem path)
bytes (raw file content)
BinaryIO (raw file content)
Rather than only accepting bytes, the file and image preparation APIs should use typing_extensions.Buffer to indicate they accept any type implementing the buffer protocol (using memoryview to extract the raw file content from such types, replacing the current dedicated bytes handling).