def _get_series_start_end_times(series):
    """Extracts the start and end times of segements defined by a boolean
    pandas Series.

    Parameters
    ----------
    series : pandas boolean Series (n_time,)
        Consecutive Trues define each segement.

    Returns
    -------
    start_times : ndarray, shape (n_segments,)
        Beginning time of each segment based on the index of the series.
    end_times : ndarray, shape (n_segments,)
        End time of each segment based on the index of the series.

    """
    is_start_time = ~series.shift(1).fillna(False) & series
    start_times = series.index[is_start_time].get_values()
    is_end_time = series & ~series.shift(-1).fillna(False)
    end_times = series.index[is_end_time].get_values()
    return start_times, end_times
