def alt2ambiguousnucleotide(alts):
    """Translate list of alt nucleotides to single IUPAC abmiguity symbol

    Uses http://www.dnabaser.com/articles/IUPAC%20ambiguity%20codes.html

    Args:
        alts: List of alternate nucleotides of a SNP

    Raises:
        KeyError: when multi alt is not in translation map

    Returns:
        string: Ambiguous nucleotide
    """
    if len(alts) == 1:
        return alts[0]
    amap = {
        'AC': 'M',
        'AT': 'W',
        'CG': 'S',
        'GT': 'K',
        'AG': 'R',
        'CT': 'Y',
        'CGT': 'B',
        'AGT': 'D',
        'ACT': 'H',
        'ACG': 'V',
        'ACGT': 'N',
    }
    alts_str = ''.join(sorted(alts))
    return amap[alts_str]