code: def _get_counter_reference(self):
          
  
          if (self.model is not None
                  and self.base_factory is not None
                  and self.base_factory._meta.model is not None
                  and issubclass(self.model, self.base_factory._meta.model)):
              return self.base_factory._meta.counter_reference
          else:
              return self
docs: Identify which factory should be used for a shared counter.