code: def _adjust_historical_forecasts_time_index(
      series: TimeSeries,
      series_idx: int,
      historical_forecasts_time_index: TimeIndex,
      start: Optional[Union[pd.Timestamp, float, int]],
      start_format: Literal["position", "value"],
      show_warnings: bool,
  ) -> TimeIndex:
      """
      Shrink the beginning and end of the historical forecasts time index based on the values of `start`,
      `forecast_horizon` and `overlap_end`.
      """
      # when applicable, shift the start of the forecastable index based on `start`
      if start is not None:
          if start_format == "value":
              start_time_ = series.get_timestamp_at_point(start)
          else:
              start_time_ = series.time_index[start]
          # ignore user-defined `start`
          if (
              not historical_forecasts_time_index[0]
              <= start_time_
              <= historical_forecasts_time_index[-1]
          ):
              if show_warnings:
                  _historical_forecasts_start_warnings(
                      idx=series_idx,
                      start=start,
                      start_time_=start_time_,
                      historical_forecasts_time_index=historical_forecasts_time_index,
                  )
          else:
              historical_forecasts_time_index = (
                  max(historical_forecasts_time_index[0], start_time_),
                  historical_forecasts_time_index[1],
              )
  
      return historical_forecasts_time_index
  
imports: from types import SimpleNamespace
  from typing import Any, Callable, Dict, Optional, Sequence, Set, Tuple, Union
  import inspect
  import numpy
  import pandas
  from numpy.typing import ArrayLike
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.timeseries import TimeSeries
  from darts.utils.timeseries_generation import generate_index
  from darts.utils.utils import series2seq
label_desc: Use image node_id 6 for calling a global function with example usage: _adjust_historical_forecasts_time_index(series, series_idx, historical_forecasts_time_index, start, start_format, show_warnings) and returns: historical_forecasts_time_index