code: def _validate_cdist_input(XA, XB, mA, mB, n, metric_name, **kwargs):
      if metric_name is not None:
          # get supported types
          types = _METRICS[metric_name].types
          # choose best type
          typ = (
              types[types.index(XA.dtype)]
              if XA.dtype in types
              else types[0]
          )
          # validate data
          XA = _convert_to_type(XA, out_type=typ)
          XB = _convert_to_type(XB, out_type=typ)
  
          # validate kwargs
          _validate_kwargs = _METRICS[metric_name].validator
          if _validate_kwargs:
              kwargs = _validate_kwargs(
                  np.vstack([XA, XB]), mA + mB, n, **kwargs
              )
      else:
          typ = None
      return XA, XB, typ, kwargs
  
imports: from __future__ import division, print_function, absolute_import
  import warnings
  import numpy
  from functools import partial
  from collections import namedtuple
  from scipy._lib.six import callable, string_types
  from scipy._lib.six import xrange
  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
label_desc: Use image node_id 9 for calling a global function with example usage: _validate_cdist_input(XA, XB, mA, mB, n, metric_name) and returns: XA,  XB,  typ,  kwargs