'Inverted function of getstate'

def __setstate__(self, state):

    cls = self.__class__
    if isinstance(state, tuple):
        self.__setstate_pre_1_0__(state)
        return
    self.id = state['id']
    for prop in cls.properties:
        if (prop in state):
            setattr(self, prop, state[prop])
