def drop_dupes(sequence):
    """Drop duplicate elements from a list or other sequence.

    C.f. https://stackoverflow.com/a/7961390

    """
    orig_type = type(sequence)
    return orig_type(list(dict.fromkeys(sequence)))