@classmethod<EOL><INDENT>def _decode_message(cls, data, offset):<DEDENT>
((crc, magic, att), cur) = relative_unpack('<STR_LIT>', data, <NUM_LIT:0>)<EOL>if crc != crc32(data[<NUM_LIT:4>:]):<EOL><INDENT>raise ChecksumError("<STR_LIT>")<EOL><DEDENT>(key, cur) = read_int_string(data, cur)<EOL>(value, cur) = read_int_string(data, cur)<EOL>codec = att & ATTRIBUTE_CODEC_MASK<EOL>if codec == CODEC_NONE:<EOL><INDENT>yield (offset, Message(magic, att, key, value))<EOL><DEDENT>elif codec == CODEC_GZIP:<EOL><INDENT>gz = gzip_decode(value)<EOL>for (offset, msg) in KafkaProtocol._decode_message_set_iter(gz):<EOL><INDENT>yield (offset, msg)<EOL><DEDENT><DEDENT>elif codec == CODEC_SNAPPY:<EOL><INDENT>snp = snappy_decode(value)<EOL>for (offset, msg) in KafkaProtocol._decode_message_set_iter(snp):<EOL><INDENT>yield (offset, msg)<EOL><DEDENT><DEDENT>
Decode a single Message

The only caller of this method is decode_message_set_iter.
They are decoupled to support nested messages (compressed MessageSets).
The offset is actually read from decode_message_set_iter (it is part
of the MessageSet payload).