code: def get_hit_count_from_obj_variable(context, obj_variable, tag_name):
      
      error_to_raise = template.TemplateSyntaxError(
          "'%(a)s' requires a valid individual model variable "
          "in the form of '%(a)s for [model_obj]'.\n"
          "Got: %(b)s" % {'a': tag_name, 'b': obj_variable}
      )
  
      try:
          obj = obj_variable.resolve(context)
      except template.VariableDoesNotExist:
          raise error_to_raise
  
      try:
          ctype = ContentType.objects.get_for_model(obj)
      except AttributeError:
          raise error_to_raise
  
      hit_count, created = HitCount.objects.get_or_create(
          content_type=ctype, object_pk=obj.pk)
  
      return hit_count
docs: Helper function to return a HitCount for a given template object variable.
  
      Raises TemplateSyntaxError if the passed object variable cannot be parsed.