code: def cdist_normalized_cc(
      dataset1, dataset2, norms1, norms2, self_similarity
  ):
      """Compute the distance matrix between two time series dataset.
  
      Parameters
      ----------
      dataset1 : array-like, shape=(n_ts1, sz, d), dtype=float64
          A dataset of time series.
      dataset2 : array-like, shape=(n_ts2, sz, d), dtype=float64
          Another dataset of time series.
      norms1 : array-like, shape=(n_ts1,), dtype=float64
      norms2 : array-like, shape=(n_ts2,), dtype=float64
      self_similarity : bool
  
      Returns
      -------
      dists : array-like, shape=(n_ts1, n_ts2), dtype=float64
      """
      n_ts1, sz, d = dataset1.shape
      n_ts2 = dataset2.shape[0]
      assert d == dataset2.shape[2]
      dists = np.zeros((n_ts1, n_ts2))
  
      if (norms1 < 0.0).any():
          for i_ts1 in prange(n_ts1):
              norms1[i_ts1] = np.linalg.norm(dataset1[i_ts1, ...])
      if (norms2 < 0.0).any():
          for i_ts2 in prange(n_ts2):
              norms2[i_ts2] = np.linalg.norm(dataset2[i_ts2, ...])
      if self_similarity:
          for i in prange(1, n_ts1):
              for j in range(i):
                  dists[i, j] = normalized_cc(
                      dataset1[i],
                      dataset2[j],
                      norm1=norms1[i],
                      norm2=norms2[j],
                  ).max()
          dists += dists.T
      else:
          for i in prange(n_ts1):
              for j in range(n_ts2):
                  dists[i, j] = normalized_cc(
                      dataset1[i],
                      dataset2[j],
                      norm1=norms1[i],
                      norm2=norms2[j],
                  ).max()
      return dists
  
imports: import numpy
  from numba import njit, objmode, prange
label_desc: Use image node_id 2 for calling a global function with example usage: cdist_normalized_cc(dataset1, dataset2, norms1, norms2, _similarity) and returns: dists