import itertools
import operator


def uniq(sequence):  # type: ignore
    """
    Given a sequence, return a generator populated only with its
    unique elements. Works for non-hashable elements too.
    """

    return map(operator.itemgetter(0), itertools.groupby(sequence))