def chunk_windows(window, chunksize):
    """Given a user window, split that window into interval tuples (start, end)
       of size chunksize."""
    chunk_start = window['start']
    chunk_end = chunk_start + chunksize
    intervals = []
    while chunk_end <= window['end']:
        interval = chunk_start, chunk_end
        intervals.append(interval)
        chunk_start += chunksize
        chunk_end += chunksize
    if chunk_start < window['end']:
        interval = chunk_start, window['end']
        intervals.append(interval)
    return intervals
