code: def _cdist_callable(XA, XB, *, out, metric, **kwargs):
      mA = XA.shape[0]
      mB = XB.shape[0]
      dm = _prepare_out_argument(out, np.float64, (mA, mB))
      for i in range(mA):
          for j in range(mB):
              dm[i, j] = metric(XA[i], XB[j], **kwargs)
      return dm
  
imports: import math
  import warnings
  import numpy
  import dataclasses
  from typing import Optional, Callable
  from functools import partial
  from scipy._lib._util import _asarray_validated
  from .None import _distance_wrap
  from .None import _hausdorff
  from ..linalg import norm
  from ..special import rel_entr
  from .None import _distance_pybind
label_desc: Use image node_id 46 for calling a global function with example usage: _cdist_callable(XA, XB) and returns: dm