code: def foreign_key_sets(chain, node):
      
      quack = False
  
      if node.attrname in MANAGER_ATTRS or node.attrname.endswith('_set'):
          # if this is a X_set method, that's a pretty strong signal that this is the default
          # Django name, rather than one set by related_name
          quack = True
      else:
          # we will
          if isinstance(node.parent, Attribute):
              func_name = getattr(node.parent, 'attrname', None)
              if func_name in MANAGER_ATTRS:
                  quack = True
  
      if quack:
          children = list(node.get_children())
          for child in children:
              try:
                  inferred_cls = child.inferred()
              except InferenceError:
                  pass
              else:
                  for cls in inferred_cls:
                      if (node_is_subclass(cls,
                                           'django.db.models.manager.Manager',
                                           'django.db.models.base.Model',
                                           '.Model',
                                           'django.db.models.fields.related.ForeignObject')):
                          # This means that we are looking at a subclass of models.Model
                          # and something is trying to access a <something>_set attribute.
                          # Since this could exist, we will return so as not to raise an
                          # error.
                          return
      chain()
docs: When a Django model has a ForeignKey to another model, the target
      of the foreign key gets a '<modelname>_set' attribute for accessing
      a queryset of the model owning the foreign key - eg:
  
      class ModelA(models.Model):
          pass
  
      class ModelB(models.Model):
          a = models.ForeignKey(ModelA)
  
      Now, ModelA instances will have a modelb_set attribute.
  
      It's also possible to explicitly name the relationship using the related_name argument
      to the ForeignKey constructor. As it's impossible to know this without inspecting all
      models before processing, we'll instead do a "best guess" approach and see if the attribute
      being accessed goes on to be used as a queryset. This is via 'duck typing': if the method
      called on the attribute being accessed is something we might find in a queryset, we'll
      warn.