def intfrombits(bits):
    """
    Given a list of boolean values, interprets them as a binary
    encoded, MSB-first unsigned integer (with True == 1 and False
    == 0) and returns the result.

    >>> intfrombits([ 1, 0, 0, 1, 1, 0, 0, 0, 0 ])
    304
    """
    ret = 0
    lsb_first = [b for b in bits]
    lsb_first.reverse()

    for bit_index in range(len(lsb_first)):
        if lsb_first[bit_index]:
            ret = ret | (1 << bit_index)

    return ret