code: def restore_review_history_for(brain_or_object):
      
      # Get the review history. Note this comes sorted from oldest to newest
      review_history = get_purged_review_history_for(brain_or_object)
  
      obj = api.get_object(brain_or_object)
      wf_tool = api.get_tool("portal_workflow")
      wf_ids = get_workflow_ids_for(brain_or_object)
      wfs = map(lambda wf_id: wf_tool.getWorkflowById(wf_id), wf_ids)
      wfs = filter(lambda wf: wf.state_var == "review_state", wfs)
      if not wfs:
          logger.error("No valid workflow found for {}".format(api.get_id(obj)))
      else:
          # It should not be possible to have more than one workflow with same
          # state_variable here. Anyhow, we don't care in this case (we only want
          # the object to have a review history).
          workflow = wfs[0]
          create_action = False
          for history in review_history:
              action_id = history["action"]
              if action_id is None:
                  if create_action:
                      # We don't want multiple creation events, we only stick to
                      # one workflow, so if this object had more thone one wf
                      # bound in the past, we still want only one creation action
                      continue
                  create_action = True
  
              # Change status and reindex
              wf_tool.setStatusOf(workflow.id, obj, history)
              indexes = ["review_state", "is_active"]
              obj.reindexObject(idxs=indexes)
docs: Restores the review history for the given brain or object