Return the bytes object that would be written to a file by dump(value, file).
value
Must be a supported type.
version
Indicates the data format that dumps should use.
allow_code
Allow to write code objects.
Raise a ValueError exception if value has (or contains an object that
has) an unsupported type.