def enumerate_slice(seq, head, tail=None):
    """Generate `index, value` pairs for slice `seq [head:tail]`.

       >>> _show (enumerate_slice (range (7), 0))
       [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6)]
       >>> _show (enumerate_slice (range (20), 5, 10))
       [(5, 5), (6, 6), (7, 7), (8, 8), (9, 9)]
       >>> _show (enumerate_slice ("abcdefghijklmnopqrstuvwxyz", 20))
       [(20, 'u'), (21, 'v'), (22, 'w'), (23, 'x'), (24, 'y'), (25, 'z')]
    """
    i = head
    for v in seq[head:tail]:
        yield i, v
        i += 1
