code: def _get_id_and_model(self, id_or_model):
          
          if isinstance(id_or_model, self.collection.model):
              model = id_or_model
          elif isinstance(id_or_model, str):
              # Assume we have an ID string
              model = self.collection.get(id_or_model)
          else:
              raise TypeError('Unexpected type {}, expected {} or {}'.format(
                  type(id_or_model), str, self.collection.model))
  
          return model.id, model
docs: Get both the model and ID of an object that could be an ID or a model.
  
          :param id_or_model:
              The object that could be an ID string or a model object.
          :param model_collection:
              The collection to which the model belongs.