code: def _parallel_pairwise(X, Y, func, n_jobs, **kwds):
      """Break the pairwise matrix in n_jobs even slices
      and compute them in parallel."""
  
      if Y is None:
          Y = X
      X, Y, dtype = _return_float_dtype(X, Y)
  
      if effective_n_jobs(n_jobs) == 1:
          return func(X, Y, **kwds)
  
      # enforce a threading backend to prevent data communication overhead
      fd = delayed(_dist_wrapper)
      ret = np.empty((X.shape[0], Y.shape[0]), dtype=dtype, order="F")
      Parallel(backend="threading", n_jobs=n_jobs)(
          fd(func, ret, s, X, Y[s], **kwds)
          for s in gen_even_slices(
              _num_samples(Y), effective_n_jobs(n_jobs)
          )
      )
  
      if (X is Y or Y is None) and func is euclidean_distances:
          # zeroing diagonal for euclidean norm.
          # TODO: do it also for other norms.
          np.fill_diagonal(ret, 0)
  
      return ret
  
imports: import itertools
  import warnings
  from functools import partial
  from numbers import Integral, Real
  import numpy
  from joblib import effective_n_jobs
  from scipy.sparse import csr_matrix, issparse
  from scipy.spatial import distance
  from ..None import config_context
  from ..exceptions import DataConversionWarning
  from ..preprocessing import normalize
  from ..utils import check_array, gen_batches, gen_even_slices, get_chunk_n_rows, is_scalar_nan
  from ..utils._mask import _get_mask
  from ..utils._param_validation import Hidden, Interval, MissingValues, Options, StrOptions, validate_params
  from ..utils.extmath import row_norms, safe_sparse_dot
  from ..utils.fixes import parse_version, sp_base_version
  from ..utils.parallel import Parallel, delayed
  from ..utils.validation import _num_samples, check_non_negative
  from ._pairwise_distances_reduction import ArgKmin
  from ._pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
label_desc: Use image node_id 29 for calling a global function with example usage: _parallel_pairwise(X, Y, func, n_jobs) and returns: ret, func