def encode_payload(self, messages):
if not messages or messages[<NUM_LIT:0>] is None:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if len(messages) == <NUM_LIT:1>:<EOL><INDENT>return messages[<NUM_LIT:0>].encode('<STR_LIT:utf-8>')<EOL><DEDENT>payload = u'<STR_LIT>'.join([(u'<STR_LIT>' % (len(p), p))<EOL>for p in messages if p is not None])<EOL>return payload.encode('<STR_LIT:utf-8>')<EOL>
Encode list of messages. Expects messages to be unicode.

        ``messages`` - List of raw messages to encode, if necessary