binarytree.py expanded.