code: def pairwise_kernels(
      X: ArrayLike,
      Y: Optional[ArrayLike] = None,
      metric: Union[
          str, Callable[[ArrayLike, ArrayLike], float]
      ] = "linear",
      filter_params: bool = False,
      n_jobs: Optional[int] = 1,
      **kwds,
  ):
      from sklearn.gaussian_process.kernels import Kernel as GPKernel
  
      if metric == "precomputed":
          X, _ = check_pairwise_arrays(X, Y, precomputed=True)
          return X
      elif isinstance(metric, GPKernel):
          raise NotImplementedError()
      elif metric in PAIRWISE_KERNEL_FUNCTIONS:
          if filter_params:
              kwds = dict(
                  (k, kwds[k])
                  for k in kwds
                  if k in KERNEL_PARAMS[metric]
              )
          assert isinstance(metric, str)
          func = PAIRWISE_KERNEL_FUNCTIONS[metric]
      elif callable(metric):
          raise NotImplementedError()
      else:
          raise ValueError("Unknown kernel %r" % metric)
  
      return func(X, Y, **kwds)
  
file_path: dask-ml/dask_ml/metrics/pairwise.py
imports: import warnings
  from typing import Any, Callable, Dict, Optional, Tuple, Union
  import dask.array
  import numpy
  from dask import delayed
  from dask.utils import derived_from
  from sklearn import metrics
  from sklearn.metrics.pairwise import KERNEL_PARAMS
  from .._typing import ArrayLike
  from ..utils import row_norms
label_desc: Use image node_id 9 for calling a global function with example usage: pairwise_kernels(X, Y, metric, filter_params, n_jobs) and returns: func, X