docs: def _encode_message(cls, message):
          """
          Encode a single message.
  
          The magic number of a message is a format version number.
          The only supported magic number right now is zero
  
          Format
          ======
          Message => Crc MagicByte Attributes Key Value
            Crc => int32
            MagicByte => int8
            Attributes => int8
            Key => bytes
            Value => bytes
          """
          if message.magic == 0:
              msg = b''.join([
                  struct.pack('>BB', message.magic, message.attributes),
                  write_int_string(message.key),
                  write_int_string(message.value)
              ])
              crc = crc32(msg)
              msg = struct.pack('>I%ds' % len(msg), crc, msg)
          else:
              raise ProtocolError("Unexpected magic number: %d" % message.magic)
          return msg