def ipreorder(self):
children = deque((self, ))<EOL>while children:<EOL><INDENT>cur_node = children.pop()<EOL>children.extend(reversed(cur_node.children))<EOL>yield cur_node<EOL><DEDENT>
Depth-first pre-order iteration of tree nodes