'Return the generated output.'

def generate_mo(self):

    keys = self.messages.keys()
    keys.sort()
    offsets = []
    ids = ''
    strs = ''
    for id in keys:
        offsets.append((len(ids), len(id), len(strs), len(self.messages[id])))
        ids += (id + '\x00')
        strs += (self.messages[id] + '\x00')
    output = []
    keystart = ((7 * 4) + (16 * len(keys)))
    valuestart = (keystart + len(ids))
    koffsets = []
    voffsets = []
    for (o1, l1, o2, l2) in offsets:
        koffsets += [l1, (o1 + keystart)]
        voffsets += [l2, (o2 + valuestart)]
    offsets = (koffsets + voffsets)
    output.append(struct.pack('Iiiiiii', 2500072158L, 0, len(keys), (7 * 4), ((7 * 4) + (len(keys) * 8)), 0, 0))
    output.append(array.array('i', offsets).tostring())
    output.append(ids)
    output.append(strs)
    return ''.join(output)
