def _postorder_traverse(root, get_children):
 def dfs(elem):
  for v in get_children(elem):
   for u in dfs(v):
    (yield u)
  (yield elem)
 for elem in dfs(root):
  (yield elem)

def _postorder_traverse ( root , get_children ) : def dfs ( elem ) : for v in get_children ( elem ) : for u in dfs ( v ) : ( yield u ) ( yield elem ) for elem in dfs ( root ) : ( yield elem )
traverse a tree in depth-first post-order .