def flipGenotype(genotype):
    """Flips a genotype.

    :param genotype: the genotype to flip.

    :type genotype: set

    :returns: the new flipped genotype (as a :py:class:`set`)

    .. testsetup::

        from pyGenClean.DupSNPs.duplicated_snps import flipGenotype

    .. doctest::

        >>> flipGenotype({"A", "T"})
        set(['A', 'T'])
        >>> flipGenotype({"C", "T"})
        set(['A', 'G'])
        >>> flipGenotype({"T", "G"})
        set(['A', 'C'])
        >>> flipGenotype({"0", "0"})
        Traceback (most recent call last):
            ...
        ProgramError: 0: unkown allele
        >>> flipGenotype({"A", "N"})
        Traceback (most recent call last):
            ...
        ProgramError: N: unkown allele

    """
    newGenotype = set()
    for allele in genotype:
        if allele == "A":
            newGenotype.add("T")
        elif allele == "C":
            newGenotype.add("G")
        elif allele == "T":
            newGenotype.add("A")
        elif allele == "G":
            newGenotype.add("C")
        else:
            msg = "%(allele)s: unknown allele" % locals()
            raise ProgramError(msg)

    return newGenotype