python homework binary tree