def decode(self, packet):
self.encoded = packet<EOL>lenLen = <NUM_LIT:1><EOL>while packet[lenLen] & <NUM_LIT>:<EOL><INDENT>lenLen += <NUM_LIT:1><EOL><DEDENT>packet_remaining = packet[lenLen+<NUM_LIT:1>:]<EOL>self.session = (packet_remaining[<NUM_LIT:0>] & <NUM_LIT>) == <NUM_LIT> <EOL>self.resultCode  = int(packet_remaining[<NUM_LIT:1>])<EOL>
Decode a CONNACK control packet.