def divide_slice(initial_slice, n_slices):
    """Create a set of smaller slices from an original slice.

    Parameters
    ----------
    initial_slice : :py:class:`slice`
        A slice which must have `start` and `stop` set.
    n_slices : int
        Number of slices to produce.

    Yields
    ------
    :py:class:`slice`
        Slices which when combined would be equivalent to `initial_slice`.
    """
    pos = start = initial_slice.start
    stop = initial_slice.stop
    chunk = (stop - start) // n_slices
    n_larger = (stop - start) % n_slices
    for _ in range(n_larger):
        yield slice(pos, pos + chunk + 1)
        pos += chunk + 1
    for _ in range(n_slices - n_larger):
        yield slice(pos, pos + chunk)
        pos += chunk
