def serialize(self, encode='pickle'):
#TODO should we mark the entity invalid on failed serialization?
        state = self.__getstate__()
        state['__module__'] = self.__class__.__module__
        state['__class__'] = self.__class__.__name__
        if encode == 'pickle':
            return _pickle.dumps(state, protocol=-1)
        elif encode == 'json' and _json:
            return _json.dumps(state)
Returns a list of roles assigned to this user.
dataset/ETHPy150Open OrbitzWorldwide/droned/romeo/lib/romeo/entity.py/Entity.serialize--crossover with--dataset/ETHPy150Open hvandenb/splunk-elasticsearch/search-elasticsearch/bin/splunklib/client.py/User.role_entities