code: def get_model(model):
      
      try:
          if isinstance(model, str):
              app_label, model_name = model.split('.', 1)
              m = loading.get_model(app_label, model_name)
              if not m:  # pragma: no cover
                  raise LookupError()  # Django < 1.7 just returns None
              return m
          elif issubclass(model, models.Model):
              return model
      except (LookupError, ValueError):
          pass
      raise ValueError(model)
docs: Given a model name as ``app_label.ModelName``, returns the Django model.