code: def walk(self, node, name='', list=list, len=len, type=type):
          
          pre_handlers = self.pre_handlers.get
          post_handlers = self.post_handlers.get
          nodestack = self.nodestack
          emptystack = len(nodestack)
          append, pop = nodestack.append, nodestack.pop
          append([node, name, list(iter_node(node, name + '_item')), -1])
          while len(nodestack) > emptystack:
              node, name, subnodes, index = nodestack[-1]
              if index >= len(subnodes):
                  handler = (post_handlers(type(node).__name__) or
                             post_handlers(name + '_name'))
                  if handler is None:
                      pop()
                      continue
                  self.cur_node = node
                  self.cur_name = name
                  handler()
                  current = nodestack and nodestack[-1]
                  popstack = current and current[0] is node
                  if popstack and current[-1] >= len(current[-2]):
                      pop()
                  continue
              nodestack[-1][-1] = index + 1
              if index < 0:
                  handler = (pre_handlers(type(node).__name__) or
                             pre_handlers(name + '_name'))
                  if handler is not None:
                      self.cur_node = node
                      self.cur_name = name
                      if handler():
                          pop()
              else:
                  node, name = subnodes[index]
                  append([node, name, list(iter_node(node, name + '_item')), -1])
docs: Walk the tree starting at a given node.
  
          Maintain a stack of nodes.