code: def pairwise_distances(X, Y=None, use_boss_distance=False, n_jobs=1):
      """Find the euclidean distance between all pairs of bop-models."""
      if use_boss_distance:
          if Y is None:
              Y = X
  
          XX_row_norms = csr_row_norms(X)
          XY = safe_sparse_dot(X, Y.T, dense_output=True)
  
          distance_matrix = np.zeros((X.shape[0], Y.shape[0]))
  
          if effective_n_jobs(n_jobs) > 1:
              Parallel(n_jobs=n_jobs, backend="threading")(
                  delayed(_dist_wrapper)(
                      distance_matrix, X, Y, s, XX_row_norms, XY
                  )
                  for s in gen_even_slices(
                      _num_samples(X), effective_n_jobs(n_jobs)
                  )
              )
          else:
              for i in range(len(distance_matrix)):
                  distance_matrix[i] = boss_distance(
                      X, Y, i, XX_row_norms, XY
                  )
  
      else:
          distance_matrix = pairwise.pairwise_distances(
              X, Y, n_jobs=n_jobs
          )
  
      if X is Y or Y is None:
          np.fill_diagonal(distance_matrix, np.inf)
  
      return distance_matrix
  
imports: from copy import copy
  from itertools import compress
  import numpy
  from joblib import Parallel, effective_n_jobs
  from sklearn.metrics import pairwise
  from sklearn.utils import check_random_state, gen_even_slices
  from sklearn.utils.extmath import safe_sparse_dot
  from sklearn.utils.fixes import delayed
  from sklearn.utils.sparsefuncs_fast import csr_row_norms
  from sklearn.utils.validation import _num_samples
  from sktime.classification.base import BaseClassifier
  from sktime.transformations.panel.dictionary_based import SFAFast
  from sktime.utils.validation.panel import check_X_y
label_desc: Use image node_id 2 for calling a global function with example usage: pairwise_distances(X, Y, use_boss_distance, n_jobs) and returns: distance_matrix