binary tree python code