def get_feature_times_target_training(
        target_series: TimeSeries,
        lags: Sequence[int],
        output_chunk_length: int,
        output_chunk_shift: int,
    ):
        """
        Helper function that returns all the times within `target_series` that can be used to
        create features and labels for training.

        More specifically:
            - The first `max_lag = -min(lags)` times are excluded, since these times
            have fewer than `max_lag` values after them, which means that we can't create
            features for these times.
            - The last `output_chunk_length - 1` times are excluded, since these times don't
            have `(output_chunk_length - 1)` values ahead of them and, therefore, we can't
            create labels for these times.
        """
        times = target_series.time_index
        # Exclude first `max_lag` times:
        max_lag = -min(lags)
        times = times[max_lag:]
        # Exclude last `output_chunk_length - 1` times:
        if output_chunk_length > 1:
            times = times[: -output_chunk_length + 1]
        if output_chunk_shift:
            times = times[:-output_chunk_shift]
        return times

        Helper function that returns all the times within `target_series` that can be used to
        create features and labels for training.

        More specifically:
            - The first `max_lag = -min(lags)` times are excluded, since these times
            have fewer than `max_lag` values after them, which means that we can't create
            features for these times.
            - The last `output_chunk_length - 1` times are excluded, since these times don't
            have `(output_chunk_length - 1)` values ahead of them and, therefore, we can't
            create labels for these times.
        
darts/tests/utils/tabularization/test_get_feature_times.py