def lookup(root): row = [root] while row: print(row) row = [kid for item in row for kid in (item.left, item.right) if kid]