def even_chunk(sample, chunk_mins, chunks_per_vid=None, center=False, min_chunk_ms=3000):
    """
    A function that when given a sample returns evenly spaced timestamp chunks
    that can be used to crop the video

    :param sample: 
        The datasample to be chunked
    :param chunk_mins: 
        The desired length of each chunk in minutes. 
        This will be the length of all returned chunks unless:
        1. The sample is shorter than chunk_mins OR 
        2. None is provided to chunks_per_vid, then the last chunk might be a shorter length.
    :param chunks_per_vid: 
        The desired number of chunks per video. 
        If a video is too short to be chunked this many times,
        then the number of chunks will be reduced such that they all fit fully. 
        If the video is shorter than a single,
        chunk a single timestamp of the entire video will be returned. 
        If None is provided (the default),
        the video will be chunked fully and the final chunk might be a shorter length
        (but not shorter than min_chunk_ms).
    :param center: 
        Whether to center the chunks (add space before the first and after the last chunk).
        False by default.
    :param min_chunk_ms: 
        Only used when chunks_per_vid is None (chunk the whole video), 
        if the final chunk is smaller than this it will be excluded
    :return: 
        A list of timestamp pairs where each pair is a tuple of (start_time, end_time) for the chunk
    """
    duration = sample.frame_reader.duration
    chunk_ms = int(chunk_mins * 60) * 1000
    if chunks_per_vid is None:
        num_chunks = duration // chunk_ms
        # The final chunk has to be at least a minimum length (or the whole video)
        if duration % chunk_ms >= min_chunk_ms or num_chunks == 0:
            num_chunks += 1
        remaining_ms = 0
    else:
        num_chunks = chunks_per_vid
        remaining_ms = duration - (chunk_ms * num_chunks)
    if remaining_ms < 0:
        # Reduce num chunks by overrun
        # Equivalent of ceil when int dividing with -ve numbers,
        num_chunks += remaining_ms // chunk_ms
        num_chunks = max(1, num_chunks)
        remaining_ms = max(0, duration - (chunk_ms * num_chunks))
    num_spaces = max(1, num_chunks - 1 + (center * 2))
    spacing_ms = remaining_ms // num_spaces
    init_space = spacing_ms if center else 0
    time_starts = [i * (chunk_ms + spacing_ms) + init_space for i in range(num_chunks)]
    time_pairs = [(x, min(x + chunk_ms, duration)) for x in time_starts]
    return time_pairs