code: def GLOBAL(self, node):
          
          global_scope_index = 1 if self._in_doctest() else 0
          global_scope = self.scopeStack[global_scope_index]
  
          # Ignore 'global' statement in global scope.
          if self.scope is not global_scope:
  
              # One 'global' statement can bind multiple (comma-delimited) names.
              for node_name in node.names:
                  node_value = Assignment(node_name, node)
  
                  # Remove UndefinedName messages already reported for this name.
                  # TODO: if the global is not used in this scope, it does not
                  # become a globally defined name.  See test_unused_global.
                  self.messages = [
                      m for m in self.messages if not
                      isinstance(m, messages.UndefinedName) or
                      m.message_args[0] != node_name]
  
                  # Bind name to global scope if it doesn't exist already.
                  global_scope.setdefault(node_name, node_value)
  
                  # Bind name to non-global scopes, but as already "used".
                  node_value.used = (global_scope, node)
                  for scope in self.scopeStack[global_scope_index + 1:]:
                      scope[node_name] = node_value
docs: Keep track of globals declarations.