def walk(node):
    """ iterate tree in pre-order depth-first search order """
yield node
for child in node.children:
    for n in walk(child):
        yield n
Looking for a good Python Tree data structure