Dedups an iterable in arbitrary order.

    Uses memory proportional to the number of unique items in ``it``.

def nub(it):
    '''Dedups an iterable in arbitrary order.

    Uses memory proportional to the number of unique items in ``it``.
    '''
    seen = set()
    for v in it:
        h = hash(v)
        if h in seen:
            continue
        seen.add(h)
        yield v