code: def paired_distances(X, Y, *, metric="euclidean", **kwds):
      """
      Compute the paired distances between X and Y.
  
      Compute the distances between (X[0], Y[0]), (X[1], Y[1]), etc...
  
      Read more in the :ref:`User Guide <metrics>`.
  
      Parameters
      ----------
      X : ndarray of shape (n_samples, n_features)
          Array 1 for distance computation.
  
      Y : ndarray of shape (n_samples, n_features)
          Array 2 for distance computation.
  
      metric : str or callable, default="euclidean"
          The metric to use when calculating distance between instances in a
          feature array. If metric is a string, it must be one of the options
          specified in PAIRED_DISTANCES, including "euclidean",
          "manhattan", or "cosine".
          Alternatively, if metric is a callable function, it is called on each
          pair of instances (rows) and the resulting value recorded. The callable
          should take two arrays from `X` as input and return a value indicating
          the distance between them.
  
      **kwds : dict
          Unused parameters.
  
      Returns
      -------
      distances : ndarray of shape (n_samples,)
          Returns the distances between the row vectors of `X`
          and the row vectors of `Y`.
  
      See Also
      --------
      sklearn.metrics.pairwise_distances : Computes the distance between every pair of
          samples.
  
      Examples
      --------
      >>> from sklearn.metrics.pairwise import paired_distances
      >>> X = [[0, 1], [1, 1]]
      >>> Y = [[0, 1], [2, 1]]
      >>> paired_distances(X, Y)
      array([0., 1.])
      """
  
      if metric in PAIRED_DISTANCES:
          func = PAIRED_DISTANCES[metric]
          return func(X, Y)
      elif callable(metric):
          # Check the matrix first (it is usually done by the metric)
          X, Y = check_paired_arrays(X, Y)
          distances = np.zeros(len(X))
          for i in range(len(X)):
              distances[i] = metric(X[i], Y[i])
          return distances
      else:
          raise ValueError("Unknown distance %s" % metric)
  
imports: import itertools
  import warnings
  from functools import partial
  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, Integral, Interval, MissingValues, Options, Real, 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 18 for calling a global function with example usage: paired_distances(X, Y) and returns: func, distances