def proximity(lfam1, lfam2, geneProximityD, proximityThreshold, strain):
    """Return True if any of the genes at strain from lfam1 are within
proximityThreshold of genes at that strain for lfam2. proximityThreshold
is measured in genes, e.g. 1 means the adjacent gene.
    """
    for gn1 in lfam1.iterGenesByStrain(strain):
        for gn2 in lfam2.iterGenesByStrain(strain):
            if gn1 < gn2:
                key = gn1, gn2
            else:
                key = gn2, gn1
            if key in geneProximityD and geneProximityD[key
                ] <= proximityThreshold:
                return True
    return False
