def encode(self):
    """ Encode a :class:`Message` to binary form. """

    # <MAGIC_BYTE: char> <CRC32: int> <PAYLOAD: bytes>
    return struct.pack('>Bi%ds' % len(self.payload), self.magic, self.calculate_checksum(), self.payload)
dataset/ETHPy150Open harelba/tail2kafka/kafka/message.py/Message.encode/original