def calculate_chunk_slices(items_per_chunk, num_items):
    """Calculate slices for indexing an adapter.

    Parameters
    ----------
    items_per_chunk: (int)
        Approximate number of items per chunk.
    num_items: (int)
        Total number of items.

    Returns
    -------
    list of slices

    """
    assert items_per_chunk > 0
    assert num_items > 0
    return [slice(i, min(i + items_per_chunk, num_items))
            for i in range(0, num_items, items_per_chunk)]