def get_feature_times_target_or_past(
        series: TimeSeries,
        lags: Sequence[int],
    ) -> pd.Index:
        """
        Helper function called by `get_feature_times` that extracts all of the times within `target_series`
        *or* `past_covariates` that can be used to create features; because we can assume all of the values
        in `lags` are negative for `target_series` and `past_covariates`, the feature time extract process is
        the same for these series when constructing prediction data.

        More specifically, we can create features for times within `serues` that have at least `max_lag = -min(lags)`
        values preceeding them, since these preceeding values are required to construct a feature vector for that time.
        Since the first `max_lag` times do not fulfill this condition, they are exluded.

        Because we're create features for predicting here, we don't need to worry about whether we can produce
        labels corresponding each time.

        Importantly, features can be constructed for times that occur after the end of `series`: this is because:
            1. We don't need to have all the `series` values up to time `t` to construct a feature for this time;
            instead, we only need to have the values from time `t - min_lag` to `t - max_lag`, where
            `min_lag = -max(lags)` and `max_lag = -min(lags)`. In other words, the latest feature we can create
            for `series` occurs at `series.end_time() + min_lag * series.freq`.
            2. We don't need to use the values of `series` to construct labels when we're creating prediction data,
            so we're able to create a feature for time `t` without having to worry about whether we can construct
            a corresponding label for this time.
        """
        times = series.time_index
        min_lag = -max(lags)
        times = times.union([
            times[-1] + i * series.freq for i in range(1, min_lag + 1)
        ])
        max_lag = -min(lags)
        times = times[max_lag:]
        return times

        Helper function called by `get_feature_times` that extracts all of the times within `target_series`
        *or* `past_covariates` that can be used to create features; because we can assume all of the values
        in `lags` are negative for `target_series` and `past_covariates`, the feature time extract process is
        the same for these series when constructing prediction data.

        More specifically, we can create features for times within `serues` that have at least `max_lag = -min(lags)`
        values preceeding them, since these preceeding values are required to construct a feature vector for that time.
        Since the first `max_lag` times do not fulfill this condition, they are exluded.

        Because we're create features for predicting here, we don't need to worry about whether we can produce
        labels corresponding each time.

        Importantly, features can be constructed for times that occur after the end of `series`: this is because:
            1. We don't need to have all the `series` values up to time `t` to construct a feature for this time;
            instead, we only need to have the values from time `t - min_lag` to `t - max_lag`, where
            `min_lag = -max(lags)` and `max_lag = -min(lags)`. In other words, the latest feature we can create
            for `series` occurs at `series.end_time() + min_lag * series.freq`.
            2. We don't need to use the values of `series` to construct labels when we're creating prediction data,
            so we're able to create a feature for time `t` without having to worry about whether we can construct
            a corresponding label for this time.
        
darts/tests/utils/tabularization/test_create_lagged_prediction_data.py