def unique_everseen(iterable):
    """List unique elements, preserving order. Remember all elements ever seen."""
    # unique_everseen('AAAABBBCCDAABBB')    --> A B C D
    seen = set()
    seen_add = seen.add

    for element in six.moves.filterfalse(seen.__contains__, iterable):
        seen_add(element)
        yield element
List unique elements, preserving order. Remember all elements ever seen.