code: def scope_lookup(self, node, name, offset=0):
          
          # If the name looks like a builtin name, just try to look
          # into the upper scope of this class. We might have a
          # decorator that it's poorly named after a builtin object
          # inside this class.
          lookup_upper_frame = (
              isinstance(node.parent, node_classes.Decorators)
              and name in MANAGER.builtins_module
          )
          if (
              any(node == base or base.parent_of(node) for base in self.bases)
              or lookup_upper_frame
          ):
              # Handle the case where we have either a name
              # in the bases of a class, which exists before
              # the actual definition or the case where we have
              # a Getattr node, with that name.
              #
              # name = ...
              # class A(name):
              #     def name(self): ...
              #
              # import name
              # class A(name.Name):
              #     def name(self): ...
  
              frame = self.parent.frame()
              # line offset to avoid that class A(A) resolve the ancestor to
              # the defined class
              offset = -1
          else:
              frame = self
          return frame._scope_lookup(node, name, offset)
docs: Lookup where the given name is assigned.
  
          :param node: The node to look for assignments up to.
              Any assignments after the given node are ignored.
          :type node: NodeNG
  
          :param name: The name to find assignments for.
          :type name: str
  
          :param offset: The line offset to filter statements up to.
          :type offset: int
  
          :returns: This scope node and the list of assignments associated to the
              given name according to the scope where it has been found (locals,
              globals or builtin).
          :rtype: tuple(str, list(NodeNG))