code: def _scope_lookup(self, node, name, offset=0):
          
          try:
              stmts = node._filter_stmts(self.locals[name], self, offset)
          except KeyError:
              stmts = ()
          if stmts:
              return self, stmts
          if self.parent:  # i.e. not Module
              # nested scope: if parent scope is a function, that's fine
              # else jump to the module
              pscope = self.parent.scope()
              if not pscope.is_function:
                  pscope = pscope.root()
              return pscope.scope_lookup(node, name)
          return builtin_lookup(name)
docs: XXX method for interfacing the scope lookup