def __setstate__(self, state):
    self.__dict__.update(state)
    self.environment = jinja2.Environment()
    self.environment.globals.update(id=__class__._get_id)
def __setstate__(self, state):
    self.__dict__.update(state)
    self.environment = jinja2.Environment()
    self.environment.globals.update(id=__class__._get_id)