code: def create_message_set(messages, codec=CODEC_NONE, key=None, compresslevel=None):
      
      if codec == CODEC_NONE:
          return [create_message(m, k) for m, k in messages]
      elif codec == CODEC_GZIP:
          return [create_gzip_message(messages, key, compresslevel)]
      elif codec == CODEC_SNAPPY:
          return [create_snappy_message(messages, key)]
      else:
          raise UnsupportedCodecError("Codec 0x%02x unsupported" % (codec,))
docs: Create a message set using the given codec.
  
      If codec is CODEC_NONE, return a list of raw Kafka messages. Otherwise,
      return a list containing a single codec-encoded message.