def byte_bit_value(byte, schema):
    """
    Extract bit(s) value from a byte.

    BYTE INDEX =  | 0 | 1 | 2 | 3 || 4 | 5 | 6 | 7 |
                 msb                              lsb
                 128                               1

    args:
        - byte value(int)
        - data schema(list): [index, bits]
          - data's starting bit index.
          - number of bits.

    returns:
        int
    """
    index, bits = schema
    if index < 0 or index > 7:
        raise ValueError('Schema index must be 0 thru 7')
    if bits < 1 or bits > 8:
        raise ValueError('Schema bits must be 1 thru 8')
    if len(list(bin(byte)[2:])) > 8:
        raise ValueError('Number too big. Not a byte value.')
    if index == 0 and bits == 8:
        return byte
    shift = 8 - (index + bits)
    mask = 255 >> shift + index
    return byte >> shift & mask
