code: def multivariate_support(func):
      """
      This decorator transforms a metric function that takes as input two univariate TimeSeries instances
      into a function that takes two equally-sized multivariate TimeSeries instances, computes the pairwise univariate
      metrics for components with the same indices, and returns a float value that is computed as a function of all the
      univariate metrics using a `reduction` subroutine passed as argument to the metric function.
      """
  
      @wraps(func)
      def wrapper_multivariate_support(*args, **kwargs):
          # we can avoid checks about args and kwargs since the input is adjusted by the previous decorator
          actual_series = args[0]
          pred_series = args[1]
  
          raise_if_not(
              actual_series.width == pred_series.width,
              "The two TimeSeries instances must have the same width.",
              logger,
          )
  
          value_list = []
          for i in range(actual_series.width):
              value_list.append(
                  func(
                      actual_series.univariate_component(i),
                      pred_series.univariate_component(i),
                      *args[2:],
                      **kwargs,
                  )
              )  # [2:] since we already know the first two arguments are the series
          if "reduction" in kwargs:
              return kwargs["reduction"](value_list)
          else:
              return (
                  signature(func)
                  .parameters["reduction"]
                  .default(value_list)
              )
  
      return wrapper_multivariate_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 2 for calling a global function with example usage: multivariate_support(func) and returns: wrapper_multivariate_support, kwargs, signature