def __getstate__(self):
        """
        Return all fields that shall be pickled. Walk the slots in the class
        hierarchy and add those to the state dictionary. If a '__dict__' slot is
        available, copy all entries to the dictionary. Also include the version
        id, which is fixed for all instances of a class.
        """
        state = getattr(self, '__dict__', {}).copy()
        for obj in type(self).mro():
            for name in getattr(obj,'__slots__',()):
                if hasattr(self, name):
                    state[name] = getattr(self, name)

        state['_version_id'] = self.current_version_id
        try:
            del state['__weakref__']
        except KeyError:
            pass
        return state
def __getstate__ ( self ) : state = getattr ( self , '__dict__' , { } ) . copy ( ) for obj in type ( self ) . mro ( ) : for name in getattr ( obj , '__slots__' , ( ) ) : if hasattr ( self , name ) : state [ name ] = getattr ( self , name ) state [ '_version_id' ] = self . current_version_id try : del state [ '__weakref__' ] except KeyError : pass return state
Return all fields that shall be pickled. Walk the slots in the class
        hierarchy and add those to the state dictionary. If a '__dict__' slot is
        available, copy all entries to the dictionary. Also include the version
        id, which is fixed for all instances of a class.