def unique(list_, key=lambda x: x):
    """efficient function to uniquify a list preserving item order"""
    seen = set()
    result = []
    for item in list_:
        seenkey = key(item)
        if seenkey in seen:
            continue
        seen.add(seenkey)
        result.append(item)
    return result
efficient function to uniquify a list preserving item order
stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/python.py