Our textwrap routine deals in slices.  This function will concat
    contiguous slices as an optimization so lookup performance is faster.
    It expects a sequence (probably a list) to add slice to or will extend
    the last slice of the sequence if it ends where the new slice begins.

def _add_slice(seq, slc):
    """ Our textwrap routine deals in slices.  This function will concat
    contiguous slices as an optimization so lookup performance is faster.
    It expects a sequence (probably a list) to add slice to or will extend
    the last slice of the sequence if it ends where the new slice begins. """
    if seq and seq[-1].stop == slc.start:
        seq[-1] = slice(seq[-1].start, slc.stop)
    else:
        seq.append(slc)