Serializes the input obj.
obj
SerializedBytes containing the serialized representation of the input object.
The object to serialize.