code: def _process_time_index(
      time_index: Union[TimeSeries, pd.DatetimeIndex],
      tz: Optional[str] = None,
      until: Optional[Union[int, str, pd.Timestamp]] = None,
      add_length: int = 0,
  ) -> Tuple[pd.DatetimeIndex, pd.DatetimeIndex]:
      """
      Extracts the time index, and optionally adds some time steps after the end of the index, and/or converts the
      index to another time zone.
  
      Returns a tuple of pd.DatetimeIndex with the first being the naive time index for generating a new TimeSeries,
      and the second being the one used for generating datetime attributes and holidays in a potentially different
      time zone.
      """
      if isinstance(time_index, TimeSeries):
          time_index = time_index.time_index
  
      if not isinstance(time_index, pd.DatetimeIndex):
          raise_log(
              ValueError(
                  "`time_index` must be a pandas `DatetimeIndex` or a `TimeSeries` indexed with a `DatetimeIndex`."
              ),
              logger=logger,
          )
      if time_index.tz is not None:
          raise_log(
              ValueError("`time_index` must be time zone naive."),
              logger=logger,
          )
      time_index = _extend_time_index_until(
          time_index, until, add_length
      )
  
      # convert to another time zone
      if tz is not None:
          time_index_ = time_index.tz_localize("UTC").tz_convert(tz)
      else:
          time_index_ = time_index
      return time_index, time_index_
  
file_path: darts/darts/utils/timeseries_generation.py
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import holidays
  import numpy
  import pandas
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
label_desc: Use image node_id 13 for calling a global function with example usage: _process_time_index(time_index, tz, until, add_length) and returns: time_index,  time_index_