Tree tools in Python