Returns an iterator that yields the first occurence of a hashable item in
    `iterable`.

def unique(iterable):
    """
    Returns an iterator that yields the first occurence of a hashable item in
    `iterable`.
    """
    seen = set()
    for obj in iterable:
        if obj not in seen:
            yield obj
            seen.add(obj)