def create_message_set(messages, codec=CODEC_NONE, key=None, compresslevel=None):
if codec == CODEC_NONE:<EOL><INDENT>return [create_message(m, k) for m, k in messages]<EOL><DEDENT>elif codec == CODEC_GZIP:<EOL><INDENT>return [create_gzip_message(messages, key, compresslevel)]<EOL><DEDENT>elif codec == CODEC_SNAPPY:<EOL><INDENT>return [create_snappy_message(messages, key)]<EOL><DEDENT>else:<EOL><INDENT>raise UnsupportedCodecError("<STR_LIT>" % codec)<EOL><DEDENT>
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.