def get_chunks(t_start, t_stop, n_chunks):
    """Group frame indices into given number of 'chunks'.

    Args:
        t_start (int): Frame index to start at (inclusive)
        t_stop (int): Frame index to stop at (exclusive)
        n_chunks (int): Number of chunks

    Returns:
        List of 2-tuples containing (start, stop) for each chunk.

    """

    # Validate input
    if t_stop <= t_start:
        raise ValueError('Start frame not before stop frame')
    if n_chunks <= 0:
        raise ValueError('Number of chunks not positive int')
    if n_chunks > (t_stop - t_start):
        raise ValueError('More chunks than frames')

    # Determine size of chunks
    sz = (t_stop - t_start) // n_chunks

    # First n-1 chunks
    chunks = []
    for k in range(n_chunks - 1):
        chunks.append((t_start + k * sz, t_start + (k + 1) * sz))

    # Final chunk
    chunks.append((t_start + (n_chunks - 1) * sz, t_stop))

    return chunks