code: def _derive_all_squared_distances_transform(
      X, n_samples, n_timestamps, window_sizes, shapelets, lengths
  ):
      """Derive the squared distances between all shapelets and time series."""
      distances = []  # save the distances in a list
      permutation = []  # save the permutation of the indices
  
      for shapelet, window_size in zip(shapelets, window_sizes):
          X_window = _windowed_view(
              X, n_samples, n_timestamps, window_size, window_step=1
          )
          indices = np.where(lengths == window_size)[0]
          permutation.append(indices)
  
          for idx in indices:
              dist = _derive_shapelet_distances(
                  X_window, shapelets[idx]
              )
              distances.append(dist)
  
      return distances, permutation
  
imports: from itertools import chain
  from joblib import delayed, Parallel
  from numba import njit, prange
  from numba.typed import List
  import numpy
  from numpy.lib.stride_tricks import as_strided
  from sklearn.base import BaseEstimator
  from sklearn.feature_selection import f_classif, mutual_info_classif
  from sklearn.utils.validation import check_array, check_is_fitted, check_random_state, check_X_y
  from ..base import UnivariateTransformerMixin
  from ..utils.utils import _windowed_view
label_desc: Use image node_id 4 for calling a global function with example usage: _derive_all_squared_distances_transform(X, n_samples, n_timestamps, window_sizes, shapelets, lengths) and returns: distances,  permutation