Yields all the unique values in an iterable maintaining order

def unique(iterable, key=identity):
    """Yields all the unique values in an iterable maintaining order"""
    seen = set()
    for item in iterable:
        item_key = key(item)
        if item_key not in seen:
            seen.add(item_key)
            yield item