def unpack_frame(message):
body = []<EOL>returned = dict(cmd='<STR_LIT>', headers={}, body='<STR_LIT>')<EOL>breakdown = message.split('<STR_LIT:\n>')<EOL>returned['<STR_LIT>'] = breakdown[<NUM_LIT:0>]<EOL>breakdown = breakdown[<NUM_LIT:1>:]<EOL>def headD(field):<EOL><INDENT>index = field.find('<STR_LIT::>')<EOL>if index:<EOL><INDENT>header = field[:index].strip()<EOL>data = field[index+<NUM_LIT:1>:].strip()<EOL><INDENT>print "<STR_LIT>" % (header, data)<EOL><DEDENT>returned['<STR_LIT>'][header.strip()] = data.strip()<EOL><DEDENT><DEDENT>def bodyD(field):<EOL><INDENT>field = field.strip()<EOL>if field:<EOL><INDENT>body.append(field)<EOL><DEDENT><DEDENT>handler = headD<EOL>for field in breakdown:<EOL><INDENT>print "<STR_LIT>", field<EOL>
Called to unpack a STOMP message into a dictionary.

    returned = {
        # STOMP Command:
        'cmd' : '...',

        # Headers e.g.
        'headers' : {
            'destination' : 'xyz',
            'message-id' : 'some event',
            :
            etc,
        }

        # Body:
        'body' : '...1234...\x00',
    }