code: def _pdist_callable(X, *, out, metric, **kwargs):
      n = X.shape[0]
      out_size = (n * (n - 1)) // 2
      dm = _prepare_out_argument(out, np.float64, (out_size,))
      k = 0
      for i in range(X.shape[0] - 1):
          for j in range(i + 1, X.shape[0]):
              dm[k] = metric(X[i], X[j], **kwargs)
              k += 1
      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 45 for calling a global function with example usage: _pdist_callable(X) and returns: dm