code: def get_object_by_natural_key(self, app_label, model_name, object_id):
          
          try:
              model_type = ContentType.objects.get_by_natural_key(app_label, model_name)
          except ContentType.DoesNotExist:
              return None
  
          # Pointless to fetch the object, if there is no URL to generate
          # Avoid another database query.
          ModelClass = model_type.model_class()
          if not hasattr(ModelClass, 'get_absolute_url'):
              return None
  
          try:
              return model_type.get_object_for_this_type(pk=object_id)
          except ObjectDoesNotExist:
              return None
docs: Return a model based on a natural key.
          This is a utility function for :func:`get_edited_object`.