'Converts the :class:`.User` instance to a :class:`dict`.
:returns:
:class:`dict`'

def to_dict(self):

    d = copy.copy(self.__dict__)
    d['provider'] = self.provider.name
    d['credentials'] = (self.credentials.serialize() if self.credentials else None)
    d['birth_date'] = str(d['birth_date'])
    d.pop('content')
    if isinstance(self.data, ElementTree.Element):
        d['data'] = None
    return d
