def ctcp_unpack_message(info):
verb = info['<STR_LIT>']<EOL>message = info['<STR_LIT>'][<NUM_LIT:1>]<EOL>infos = []<EOL>X_QUOTE = '<STR_LIT:\\>'<EOL>X_DELIM = '<STR_LIT>'<EOL>messages = str(message).split(X_DELIM)<EOL>for i in range(len(messages)):<EOL><INDENT>msg = messages[i]<EOL>new_info = dict(info)<EOL>if i % <NUM_LIT:2> == <NUM_LIT:0>:  <EOL><INDENT>if not msg:<EOL><INDENT>continue<EOL><DEDENT>new_info['<STR_LIT>'] = new_info['<STR_LIT>'][:<NUM_LIT:1>]<EOL>new_info['<STR_LIT>'].append(msg)<EOL><DEDENT>else:<EOL><INDENT>if verb in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>new_info['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>new_info['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>if '<STR_LIT:U+0020>' in msg.lstrip():<EOL><INDENT>new_info['<STR_LIT>'], new_info['<STR_LIT>'] = msg.lstrip().split('<STR_LIT:U+0020>', <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>new_info['<STR_LIT>'] = msg.lstrip()<EOL>new_info['<STR_LIT>'] = '<STR_LIT>'<EOL><DEDENT>new_info['<STR_LIT>'] = new_info['<STR_LIT>'].lower()<EOL><DEDENT>infos.append([new_info['<STR_LIT>'], new_info])<EOL><DEDENT>for i in range(len(infos)):<EOL><INDENT>if infos[i][NAME_ATTR] == '<STR_LIT>':<EOL><INDENT>attrs = ['<STR_LIT>', '<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>attrs = ['<STR_LIT>']<EOL><DEDENT>for attr in attrs:<EOL><INDENT>if isinstance(infos[i][INFO_ATTR][attr], (list, tuple)):<EOL><INDENT>raw_messages = infos[i][INFO_ATTR][attr]<EOL><DEDENT>else:<EOL><INDENT>raw_messages = [infos[i][INFO_ATTR][attr]]<EOL><DEDENT>messages = []<EOL>for raw in raw_messages:<EOL><INDENT>unquoted = '<STR_LIT>'<EOL>while len(raw):<EOL><INDENT>char = raw[<NUM_LIT:0>]<EOL>raw = raw[<NUM_LIT:1>:]<EOL>if char == X_QUOTE:<EOL><INDENT>if not len(raw):<EOL><INDENT>continue<EOL><DEDENT>key = raw[<NUM_LIT:0>]<EOL>raw = raw[<NUM_LIT:1>:]<EOL>if key == '<STR_LIT:a>':<EOL><INDENT>unquoted += X_DELIM<EOL><DEDENT>elif key == X_QUOTE:<EOL><INDENT>unquoted += X_QUOTE<EOL><DEDENT>else:<EOL><INDENT>unquoted += key<EOL><DEDENT><DEDENT>else:<EOL><INDENT>unquoted += char<EOL><DEDENT><DEDENT>messages.append(unquoted)<EOL><DEDENT>if isinstance(infos[i][INFO_ATTR][attr], (list, tuple)):<EOL><INDENT>infos[i][INFO_ATTR][attr] = messages<EOL><DEDENT>else:<EOL><INDENT>infos[i][INFO_ATTR][attr] = messages[<NUM_LIT:0>]<EOL><DEDENT><DEDENT><DEDENT>return infos<EOL>
Given a an input message (privmsg/pubmsg/notice), return events.