code: def _dtw_multiscale(
      x,
      y,
      dist="square",
      resolution=2,
      radius=0,
      return_cost=False,
      return_accumulated=False,
      return_path=False,
  ):
      """Multiscale Dynamic Time Warping (DTW) distance.
  
      This version of DTW builds an adaptive constraint region. First both time
      series are downsampled, with the sizes of the original times series being
      divided by ``resolution``. Then the optimal path between the two
      downsampled time series is computed. Finally this optimal path is
      projected on the orginal scale and used as the constraint region.
  
      Options
      -------
      resolution : int (default = 2)
          The resolution level.
  
      radius : int (default = 0)
          The radius used to expand the constraint region. The optimal path
          computed at the resolution level is expanded with `radius` cells to the
          top, bottom, left and right of every cell belonging to the optimal
          path. It is computed at the resolution level.
  
      References
      ----------
      .. [1] M. Müller, H. Mattes and F. Kurth, "An efficient multiscale approach
             to audio synchronization". International Conference on Music
             Information Retrieval, 6(1), 192-197 (2006).
  
      """
      (
          x,
          y,
          precomputed_cost,
          n_timestamps_1,
          n_timestamps_2,
      ) = _check_input_dtw(
          x, y, precomputed_cost=None, dist=dist, method="multiscale"
      )
  
      region = _multiscale_region(
          x, y, dist, resolution=resolution, radius=radius
      )
      cost_mat = cost_matrix(x, y, dist=dist, region=region)
      acc_cost_mat = accumulated_cost_matrix(cost_mat, region=region)
      dtw_dist = acc_cost_mat[-1, -1]
      if dist == "square":
          dtw_dist = sqrt(dtw_dist)
  
      res = _return_results(
          dtw_dist,
          cost_mat,
          acc_cost_mat,
          return_cost,
          return_accumulated,
          return_path,
      )
      return res
  
imports: import numpy
  from math import ceil, log2, sqrt
  from numba import njit, prange
  from sklearn.utils import check_array
label_desc: Use image node_id 27 for calling a global function with example usage: _dtw_multiscale(x, y, dist, resolution, radius, return_cost, return_accumulated, return_path) and returns: res