def scope_lookup(self, node, name, offset=<NUM_LIT:0>):
<EOL>lookup_upper_frame = (<EOL>isinstance(node.parent, node_classes.Decorators)<EOL>and name in MANAGER.builtins_module<EOL>)<EOL>if (<EOL>any(node == base or base.parent_of(node) for base in self.bases)<EOL>or lookup_upper_frame<EOL>):<EOL><INDENT>frame = self.parent.frame()<EOL>offset = -<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>frame = self<EOL><DEDENT>return frame._scope_lookup(node, name, offset)<EOL>
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))