<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _collapseMsg(self, msg):
 """ Take msg, which is a dictionary of lists of output chunks, and concatenate all the chunks into a single string """

        retval = {}
        for logname in msg:
            data = u""
            for m in msg[logname]:
                m = bytes2unicode(m, self.builder.unicode_encoding)
                data += m
            if isinstance(logname, tuple) and logname[0] == 'log':
                retval['log'] = (logname[1], data)
            else:
                retval[logname] = data
        return retval