def _find_gaps_split(datagap_times: list, existing_gap_times: list):
    """
    helper for compare_and_find_gaps.  A function to use in a loop to continue splitting gaps until they no longer
    include any existing gaps

    datagap_times = [[0,5], [30,40], [70, 82], [90,100]]

    existing_gap_times = [[10,15], [35,45], [75,80], [85,95]]

    split_dgtime = [[0, 5], [30, 40], [70, 75], [80, 82], [90, 100]]

    Parameters
    ----------
    datagap_times
        list, list of two element lists (start time, end time) for the gaps found in the new data
    existing_gap_times
        list, list of two element lists (start time, end time) for the gaps found in the existing data

    Returns
    -------
    list
        list of two element lists (start time, end time) for the new data gaps split around the existing data gaps
    """

    split = False
    split_dgtime = []
    for dgtime in datagap_times:
        for existtime in existing_gap_times:
            # datagap contains an existing gap, have to split the datagap
            if (dgtime[0] <= existtime[0] <= dgtime[1]) and (dgtime[0] <= existtime[1] <= dgtime[1]):
                split_dgtime.append([dgtime[0], existtime[0]])
                split_dgtime.append([existtime[1], dgtime[1]])
                split = True
                break
        if not split:
            split_dgtime.append(dgtime)
        else:
            split = False
    return split_dgtime