code: def _bulk_history_create(self, model, batch_size):
          
  
          instances = []
          history = utils.get_history_manager_for_model(model)
          if self.verbosity >= 1:
              self.stdout.write(
                  "Starting bulk creating history models for {} instances {}-{}".format(
                      model, 0, batch_size
                  )
              )
  
          iterator_kwargs = (
              {"chunk_size": batch_size} if django.VERSION >= (2, 0, 0) else {}
          )
          for index, instance in enumerate(
              model._default_manager.iterator(**iterator_kwargs)
          ):
              # Can't Just pass batch_size to bulk_create as this can lead to
              # Out of Memory Errors as we load too many models into memory after
              # creating them. So we only keep batch_size worth of models in
              # historical_instances and clear them after we hit batch_size
              if index % batch_size == 0:
  
                  history.bulk_history_create(instances, batch_size=batch_size)
  
                  instances = []
  
                  if self.verbosity >= 1:
                      self.stdout.write(
                          "Finished bulk creating history models for {} "
                          "instances {}-{}, starting next {}".format(
                              model, index - batch_size, index, batch_size
                          )
                      )
  
              instances.append(instance)
  
          # create any we didn't get in the last loop
          if instances:
              history.bulk_history_create(instances, batch_size=batch_size)
docs: Save a copy of all instances to the historical model.
  
          :param model: Model you want to bulk create
          :param batch_size: number of models to create at once.
          :return: