code: def get_cat_model(model):
      
      try:
          if isinstance(model, string_types):
              model_class = apps.get_model(*model.split("."))
          elif issubclass(model, CategoryBase):
              model_class = model
          if model_class is None:
              raise TypeError
      except TypeError:
          raise TemplateSyntaxError("Unknown model submitted: %s" % model)
      return model_class
docs: Return a class from a string or class