code: def restore_simulation(directory, tax_benefit_system, **kwargs):
      
      simulation = Simulation(tax_benefit_system, tax_benefit_system.instantiate_entities())
  
      entities_dump_dir = os.path.join(directory, "__entities__")
      for population in simulation.populations.values():
          if population.entity.is_person:
              continue
          person_count = _restore_entity(population, entities_dump_dir)
  
      for population in simulation.populations.values():
          if not population.entity.is_person:
              continue
          _restore_entity(population, entities_dump_dir)
          population.count = person_count
  
      variables_to_restore = (variable for variable in os.listdir(directory) if variable != "__entities__")
      for variable in variables_to_restore:
          _restore_holder(simulation, variable, directory)
  
      return simulation
docs: Restore simulation from directory