def MapIdentifiers(seqs, pattern):

    rx = re.compile(pattern)

    for k, s in seqs.items():
        try:
            nk = rx.search(k).groups()[0]
        except __HOLE__:
            raise ValueError(
                "identifier can not be parsed from '%s' "
                "pattern='%s'" % (k, pattern))

        del seqs[k]
        seqs[nk] = s
dataset/ETHPy150Open CGATOxford/cgat/scripts/diff_fasta.py/MapIdentifiers