def __iter__(self):
for node in chain(*imap(iter, self.children)):<EOL><INDENT>yield node<EOL><DEDENT>yield self<EOL>
Iterate through tree, leaves first

following http://stackoverflow.com/questions/6914803/python-iterator-through-tree-with-list-of-children