def METHOD_NAME(set1, set2, unrooted=False):
    for s1 in set1:
        pairs = []
        for r1 in set2:
            if unrooted:
                d = euc_dist_unrooted(s1, r1)
            else:
                d = euc_dist(s1, r1)
            if d < 1:
                pairs.append((d,r1))
        yield s1, pairs