def hamming(g1,g2,cutoff=1):
    """
    Compare two genotypes and determine if they are within cutoff sequence
    differences of one another.

    Parameters
    ----------
    g1, g2 : strs
        two genotypes to compare (must be same length)
    cutoff : int
        max allowable sequence differences between them

    Returns
    -------
    neighbor : bool
        whether or not the genotypes are neighbors
    """

    try:
        if len(g1) != len(g2):
            raise TypeError
    except TypeError:
        err = "g1 and g2 must have the same length\n"
        raise ValueError(err)

    return sum([g1[i] != g2[i] for i in range(len(g1))]) <= cutoff