I have a byte (from some other vendor) where the potential bit masks are as follows:
value1 = 0x01 value2 = 0x02 value3 = 0x03 value4 = 0x04 value5 = 0x05 value6 = 0x06
It's a little verbose but perfectly fine. The only change I'd make is to simplify parse_byte:
def parse_byte(byte): value7_set = byte & value7 == value7 value8_set = byte & value8 == value8 base_value = mask_bits_on_byte(byte,value7 | value8) return value7_set,value8_set,base_value