code: def multi_ts_support(func):
      """
      This decorator further adapts the metrics that took as input two univariate/multivariate ``TimeSeries`` instances,
      adding support for equally-sized sequences of ``TimeSeries`` instances. The decorator computes the pairwise metric
      for ``TimeSeries`` with the same indices, and returns a float value that is computed as a function of all the
      pairwise metrics using a `inter_reduction` subroutine passed as argument to the metric function.
  
      If a 'Sequence[TimeSeries]' is passed as input, this decorator provides also parallelisation of the metric
      evaluation regarding different ``TimeSeries`` (if the `n_jobs` parameter is not set 1).
      """
  
      @wraps(func)
      def wrapper_multi_ts_support(*args, **kwargs):
          actual_series = (
              kwargs["actual_series"]
              if "actual_series" in kwargs
              else args[0]
          )
          pred_series = (
              kwargs["pred_series"]
              if "pred_series" in kwargs
              else args[0]
              if "actual_series" in kwargs
              else args[1]
          )
  
          n_jobs = kwargs.pop(
              "n_jobs", signature(func).parameters["n_jobs"].default
          )
          verbose = kwargs.pop(
              "verbose", signature(func).parameters["verbose"].default
          )
  
          raise_if_not(
              isinstance(n_jobs, int), "n_jobs must be an integer"
          )
          raise_if_not(
              isinstance(verbose, bool), "verbose must be a bool"
          )
  
          actual_series = (
              [actual_series]
              if not isinstance(actual_series, Sequence)
              else actual_series
          )
          pred_series = (
              [pred_series]
              if not isinstance(pred_series, Sequence)
              else pred_series
          )
  
          raise_if_not(
              len(actual_series) == len(pred_series),
              "The two TimeSeries sequences must have the same length.",
              logger,
          )
  
          num_series_in_args = int("actual_series" not in kwargs) + int(
              "pred_series" not in kwargs
          )
          kwargs.pop("actual_series", 0)
          kwargs.pop("pred_series", 0)
  
          iterator = _build_tqdm_iterator(
              iterable=zip(actual_series, pred_series),
              verbose=verbose,
              total=len(actual_series),
          )
  
          value_list = _parallel_apply(
              iterator=iterator,
              fn=func,
              n_jobs=n_jobs,
              fn_args=args[num_series_in_args:],
              fn_kwargs=kwargs,
          )
  
          # in case the reduction is not reducing the metrics sequence to a single value, e.g., if returning the
          # np.ndarray of values with the identity function, we must handle the single TS case, where we should
          # return a single value instead of a np.array of len 1
  
          if len(value_list) == 1:
              value_list = value_list[0]
  
          if "inter_reduction" in kwargs:
              return kwargs["inter_reduction"](value_list)
          else:
              return (
                  signature(func)
                  .parameters["inter_reduction"]
                  .default(value_list)
              )
  
      return wrapper_multi_ts_support
  
imports: from functools import wraps
  from inspect import signature
  from typing import Callable, Optional, Sequence, Tuple, Union
  from warnings import warn
  import numpy
  from darts import TimeSeries
  from darts.dataprocessing import dtw
  from darts.logging import get_logger, raise_if_not, raise_log
  from darts.utils import _build_tqdm_iterator, _parallel_apply
  from darts.utils.statistics import check_seasonality
label_desc: Use image node_id 1 for calling a global function with example usage: multi_ts_support(func) and returns: wrapper_multi_ts_support, kwargs, signature