'Helper for refilemessages() to copy sequences.'

def _copysequences(self, fromfolder, refileditems):

    fromsequences = fromfolder.getsequences()
    tosequences = self.getsequences()
    changed = 0
    for (name, seq) in fromsequences.items():
        try:
            toseq = tosequences[name]
            new = 0
        except KeyError:
            toseq = []
            new = 1
        for (fromn, ton) in refileditems:
            if (fromn in seq):
                toseq.append(ton)
                changed = 1
        if (new and toseq):
            tosequences[name] = toseq
    if changed:
        self.putsequences(tosequences)
