def stable_uniq(L):
    """
    Given an iterable L, remove duplicate items from L by keeping only
    the last occurance of any item.

    The items must be hashable.

    EXAMPLES::

        sage: from sage_setup.util import stable_uniq
        sage: stable_uniq( (1, 2, 3, 4, 5, 6, 3, 7, 5, 1, 5, 9) )
        [2, 4, 6, 3, 7, 1, 5, 9]
    """
    D = {}
    for pos, item in enumerate(L):
        D[item] = pos  # Store the last position where an item appears
    return sorted(D, key=lambda item: D[item])