def default_marshaller(obj):
if hasattr(obj, '<STR_LIT>'):<EOL><INDENT>return obj.__getstate__()<EOL><DEDENT>try:<EOL><INDENT>return obj.__dict__<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise TypeError('<STR_LIT>'<EOL>.format(obj.__class__.__name__))<EOL><DEDENT>
Retrieve the state of the given object.

Calls the ``__getstate__()`` method of the object if available, otherwise returns the
``__dict__`` of the object.

:param obj: the object to marshal
:return: the marshalled object state