docs: def ignore_import_warnings_for_related_fields(orig_method, self, node):
      """
      Replaces the leave_module method on the VariablesChecker class to
      prevent unused-import warnings which are caused by the ForeignKey
      and OneToOneField transformations. By replacing the nodes in the
      AST with their type rather than the django field, imports of the
      form 'from django.db.models import OneToOneField' raise an unused-import
      warning
      """
      consumer = self._to_consume[0]  # pylint: disable=W0212
      # we can disable this warning ('Access to a protected member _to_consume of a client class')
      # as it's not actually a client class, but rather, this method is being monkey patched
      # onto the class and so the access is valid
  
      new_things = {}
  
      iterat = consumer.to_consume.items if PY3 else consumer.to_consume.iteritems
      for name, stmts in iterat():
          if isinstance(stmts[0], ImportFrom):
              if any([n[0] in ('ForeignKey', 'OneToOneField') for n in stmts[0].names]):
                  continue
          new_things[name] = stmts
  
      consumer._atomic = ScopeConsumer(new_things, consumer.consumed, consumer.scope_type)  # pylint: disable=W0212
      self._to_consume = [consumer]  # pylint: disable=W0212
  
      return orig_method(self, node)