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
You don't need the other two functions:
def parse_byte(byte): value7_set = byte & value7 == value7 value8_set = byte & value8 == value8 base_value = byte & 7 return value7_set,value8_set,base_value