code: def restore_review_history_for_affected_objects(portal):
      
      logger.info("Restoring review_history ...")
      query = dict(portal_type=NEW_SENAITE_WORKFLOW_BINDINGS)
      brains = api.search(query, UID_CATALOG)
      total = len(brains)
      done = 0
      for num, brain in enumerate(brains):
          if num % 100 == 0:
              logger.info("Restoring review_history: {}/{}"
                          .format(num, total))
  
          review_history = api.get_review_history(brain, rev=False)
          if review_history:
              # Nothing to do. The object already has the review history set
              continue
  
          # Object without review history. Set the review_history manually
          restore_review_history_for(brain)
  
          done += 1
          if done % 1000 == 0:
              commit_transaction(portal)
  
      logger.info("Restoring review history: {} processed [DONE]".format(done))
docs: Applies the review history for objects that are bound to new senaite_*
      workflows