def parenthesize(b):
    """
    Return a parenthesized expression equivalent to the arithmetic
    expression tree rooted at b.

    Assume:  -- b is a binary tree
             -- interior nodes contain value in {'+', '-', '*', '/'}
             -- interior nodes always have two children
             -- leaves contain float value

    @param BinaryTree b: arithmetic expression tree
    @rtype: str

    >>> b1 = BinaryTree(3.0)
    >>> print(parenthesize(b1))
    3.0
    >>> b2 = BinaryTree(4.0)
    >>> b3 = BinaryTree(7.0)
    >>> b4 = BinaryTree("*", b1, b2)
    >>> parenthesize(b4)
    '(3.0 * 4.0)'
    >>> b5 = BinaryTree("+", b4, b3)
    >>> print(parenthesize(b5))
    ((3.0 * 4.0) + 7.0)
    """
    if b.left is None and b.right is None:
        return str(b.value)
    else:
        return "({} {} {})".format(parenthesize(b.left),\
                                   b.value,\
                                   parenthesize(b.right))