def bdecode(block):
    """
    Decode a block descriptor to get its left and right sides and level.

    A block string consisting of (0, 1), with optionally one colon. The
    number of digits after the colon is the refinemenet level. The combined
    digits denote the binary representation of the left edge.
    """

    if ":" in block:
        level = len(block) - block.find(":") - 1
    else:
        level = 0
    bst = block.replace(":", "")
    d = float(2 ** len(bst))
    left = int(bst, 2)
    right = left + 1
    left /= d
    right /= d
    return level, left, right