code: def is_field_remote(model, field_name):
      
      if not hasattr(model, '_meta'):
          # ephemeral model with no metaclass
          return False
  
      model_field = get_model_field(model, field_name)
      return isinstance(model_field, (ManyToManyField, RelatedObject))
docs: Check whether a given model field is a remote field.
  
      A remote field is the inverse of a one-to-many or a
      many-to-many relationship.
  
      Arguments:
          model: a Django model
          field_name: the name of a field
  
      Returns:
          True if `field_name` is a remote field, False otherwise.