def _extend_series_for_overlap_end(
    series: Sequence[TimeSeries],
    historical_forecasts: Sequence[Sequence[TimeSeries]],
):
    """Extends each target `series` to the end of the last historical forecast for that series.
    Fills the values all missing dates with `np.nan`.

    Assumes the input meets the multiple `series` case with `last_points_only=False` (e.g. the output of
    `darts.utils.historical_forecasts.utils_process_historical_forecast_for_backtest()`).
    """
    series_extended = []
    append_vals = [np.nan] * series[0].n_components
    for series_, hfcs_ in zip(series, historical_forecasts):
        # find number of missing target time steps based on the last forecast
        missing_steps = n_steps_between(
            hfcs_[-1].end_time(), series[0].end_time(), freq=series[0].freq
        )
        # extend the target if it is too short
        if missing_steps > 0:
            series_extended.append(
                series_.append_values(np.array([append_vals] * missing_steps))
            )
        else:
            series_extended.append(series_)
    return series_extended
Extends each target `series` to the end of the last historical forecast for that series.
    Fills the values all missing dates with `np.nan`.

    Assumes the input meets the multiple `series` case with `last_points_only=False` (e.g. the output of
    `darts.utils.historical_forecasts.utils_process_historical_forecast_for_backtest()`).
    
darts/utils/historical_forecasts/utils.py