code: def _check_valid_input(
      model,
      input_type: str,
      series: Sequence[TimeSeries],
      past_covariates: Optional[Sequence[TimeSeries]],
      future_covariates: Optional[Sequence[TimeSeries]],
      target_components: Optional[List[str]],
      past_covariates_components: Optional[List[str]],
      future_covariates_components: Optional[List[str]],
      check_component_names: bool = False,
      requires_input: bool = False,
      test_stationarity: bool = False,
  ):
      """Checks that the input is valid"""
      if test_stationarity and series is not None:
          if not _test_stationarity(series):
              logger.warning(
                  "At least one component of the target series is not stationary. "
                  "Beware of wrong interpretation of the chosen explainability."
              )
  
      if input_type not in ["background", "foreground"]:
          raise_log(
              ValueError(
                  f"Unknown `input_type='{input_type}'`. Must be one of ['background', 'foreground']."
              ),
              logger,
          )
      if past_covariates is not None:
          raise_if_not(
              len(series) == len(past_covariates),
              f"The number of {input_type} series and past covariates must be the same.",
              logger,
          )
  
      if future_covariates is not None:
          raise_if_not(
              len(series) == len(future_covariates),
              f"The number of {input_type} series and future covariates must be the same.",
              logger,
          )
  
      if requires_input:
          raise_if(
              model.uses_past_covariates and past_covariates is None,
              f"A {input_type} past covariates is not provided, but the model requires past covariates.",
              logger,
          )
          raise_if(
              model.uses_future_covariates
              and future_covariates is None,
              f"A {input_type} future covariates is not provided, but the model requires future covariates.",
              logger,
          )
  
      if not check_component_names:
          return
  
      # ensure we have the same names between TimeSeries (if list of). Important to ensure homogeneity
      # for explained features.
      for idx in range(len(series)):
          raise_if_not(
              all(
                  [
                      series[idx].columns.to_list()
                      == target_components,
                      past_covariates[idx].columns.to_list()
                      == past_covariates_components
                      if past_covariates is not None
                      else True,
                      future_covariates[idx].columns.to_list()
                      == future_covariates_components
                      if future_covariates is not None
                      else True,
                  ]
              ),
              "Columns names must be identical between TimeSeries list components (multi-TimeSeries).",
          )
  
file_path: darts/darts/explainability/utils.py
imports: from typing import List, Optional, Sequence, Tuple, Union
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not, raise_log
  from darts.models.forecasting.forecasting_model import ForecastingModel
  from darts.utils.statistics import stationarity_tests
  from darts.utils.utils import series2seq
label_desc: Use image node_id 4 for calling a global function with example usage: _check_valid_input(model, input_type, series, past_covariates, future_covariates, target_components, past_covariates_components, future_covariates_components, check_component_names, requires_input, test_stationarity) without return types