def get_indices(integers):
    """
    :param integers: a sequence of integers (with repetitions)
    :returns: a dict integer -> [(start, stop), ...]

    >>> get_indices([0, 0, 3, 3, 3, 2, 2, 0])
    {0: [(0, 2), (7, 8)], 3: [(2, 5)], 2: [(5, 7)]}
    """
    indices = AccumDict(accum=[])  # idx -> [(start, stop), ...]
    start = 0
    for i, vals in itertools.groupby(integers):
        n = sum(1 for val in vals)
        indices[i].append((start, start + n))
        start += n
    return indices