<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def default_marshaller(obj):
 """ 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 """

    if hasattr(obj, '__getstate__'):
        return obj.__getstate__()

    try:
        return obj.__dict__
    except AttributeError:
        raise TypeError('{!r} has no __dict__ attribute and does not implement __getstate__()'
                        .format(obj.__class__.__name__))