Python algorithms for traversing a binary tree.