A utility function to print tree
def preorder ( root ) : NEW_LINE INDENT if root is not None : NEW_LINE INDENT print " key : ▁ % d " % ( root . key ) , NEW_LINE if root . left is not None : NEW_LINE INDENT print " | ▁ left ▁ child : ▁ % d " % ( root . left . key ) , NEW_LINE DEDENT if root . right is not None : NEW_LINE INDENT print " | ▁ right ▁ child ▁ % d " % ( root . right . key ) , NEW_LINE DEDENT print " " NEW_LINE preorder ( root . left ) NEW_LINE preorder ( root . right ) NEW_LINE DEDENT DEDENT