docstr: returns tuple of (past_start, past_end, future_start, future_end)
docstr_tok: ["returns","tuple","of","(","past_start",",","past_end",",","future_start",",","future_end",")"]
code: def _covariate_indexer(
      target_idx: int,
      past_start: Union[pd.Timestamp, int],
      past_end: Union[pd.Timestamp, int],
      covariate_series: TimeSeries,
      covariate_type: CovariateType,
      input_chunk_length: int,
      output_chunk_length: int,
      n: int,
  ):
      """returns tuple of (past_start, past_end, future_start, future_end)"""
      # get the main covariate type: CovariateType.PAST or CovariateType.FUTURE
      main_covariate_type = (
          CovariateType.PAST
          if covariate_type is CovariateType.PAST
          else CovariateType.FUTURE
      )
  
      if main_covariate_type not in [
          CovariateType.PAST,
          CovariateType.FUTURE,
      ]:
          raise_log(
              ValueError(
                  "`main_covariate_type` must be one of `(CovariateType.PAST, CovariateType.FUTURE)`"
              ),
              logger=logger,
          )
  
      # we need to use the time index (datetime or integer) here to match the index with the covariate series
      if main_covariate_type is CovariateType.PAST:
          future_end = (
              past_end
              + max(0, n - output_chunk_length) * covariate_series.freq
          )
      else:  # CovariateType.FUTURE
          future_end = (
              past_end
              + max(n, output_chunk_length) * covariate_series.freq
          )
  
      future_start = (
          past_end + covariate_series.freq
          if future_end != past_end
          else future_end
      )
  
      if input_chunk_length == 0:  # for regression ensemble models
          past_start, past_end = future_start, future_start
  
      # check if case specific indexes are available
      case_start = (
          future_start
          if covariate_type is CovariateType.FUTURE
          else past_start
      )
      if not covariate_series.start_time() <= case_start:
          raise_log(
              ValueError(
                  f"For the given forecasting case, the provided {main_covariate_type.value} covariates at "
                  f"dataset index `{target_idx}` do not extend far enough into the past. The "
                  f"{main_covariate_type.value} covariates must start at time step `{case_start}`, whereas now "
                  f"they start at time step `{covariate_series.start_time()}`."
              ),
              logger=logger,
          )
      if not covariate_series.end_time() >= future_end:
          raise_log(
              ValueError(
                  f"For the given forecasting horizon `n={n}`, the provided {main_covariate_type.value} covariates "
                  f"at dataset index `{target_idx}` do not extend far enough into the future. As `"
                  f"{'n > output_chunk_length' if n > output_chunk_length else 'n <= output_chunk_length'}"
                  f"` the {main_covariate_type.value} covariates must end at time step `{future_end}`, "
                  f"whereas now they end at time step `{covariate_series.end_time()}`."
              ),
              logger=logger,
          )
  
      # extract the index position (index) from time_index value
      covariate_start = covariate_series.time_index.get_loc(past_start)
      covariate_end = (
          covariate_series.time_index.get_loc(future_end) + 1
      )
      return covariate_start, covariate_end
  
imports: import bisect
  from abc import ABC, abstractmethod
  from typing import Optional, Sequence, Tuple, Union
  import numpy
  import pandas
  from torch.utils.data import Dataset
  from darts import TimeSeries
  from darts.logging import get_logger, raise_log
  from darts.utils.historical_forecasts.utils import _process_predict_start_points_bounds
  from .utils import CovariateType
label_desc: Use image node_id 4 for calling the InferenceDataset obj's underlying member method code with example usage: obj._covariate_indexer(target_idx, past_start, past_end, covariate_series, covariate_type, input_chunk_length, output_chunk_length, n) and returns: covariate_start,  covariate_end