def slices(start, xs):
    """Returns slices of a given sequence separated by the specified indices.

    If we wanted to get the slices necessary to split range(20) in
    sub-sequences of 5 items each we'd do:

    >>> seq = range(20) 
    >>> indices = [5, 10, 15]
    >>> for piece in slices(0, indices):
    ...     print seq[piece]
    [0, 1, 2, 3, 4]
    [5, 6, 7, 8, 9]
    [10, 11, 12, 13, 14]
    [15, 16, 17, 18, 19]

    @param start: Index of the first element of the sequence we want to
    partition.
    @type start: C{int}.

    @param xs: Sequence of indexes where 'cuts' must be made.
    @type xs: C{list}

    @return: A sequence of C{slice} objects suitable for splitting a list as
    specified.
    @rtype: C{list} of C{slice}
    """
    if xs == []:
        # The last slice includes all the remaining items in the sequence.
        return [slice(start, None)]
    return [slice(start, xs[0])] + slices(xs[0], xs[1:])