def unique2(gen):
    memo = set()
    for x,y in gen:
        if y not in memo:
            memo.add(y)
            yield x
given a generator of pairs (x,y), generate one x for each value of y
dataset/ETHPy150Open Microsoft/ivy/src/ivy/ivy_utils.py/unique2