update to tree

added function level_partition to tree.py