flattenTree.py