code: def _args_to_kwargs_xdist(args, kwargs, metric, func_name):
      """
      Convert legacy positional arguments to keyword arguments for pdist/cdist.
      """
      if not args:
          return kwargs
  
      if callable(metric) and metric not in [
          braycurtis,
          canberra,
          chebyshev,
          cityblock,
          correlation,
          cosine,
          dice,
          euclidean,
          hamming,
          jaccard,
          jensenshannon,
          kulsinski,
          mahalanobis,
          matching,
          minkowski,
          rogerstanimoto,
          russellrao,
          seuclidean,
          sokalmichener,
          sokalsneath,
          sqeuclidean,
          yule,
          wminkowski,
      ]:
          raise TypeError(
              "When using a custom metric arguments must be passed"
              "as keyword (i.e., ARGNAME=ARGVALUE)"
          )
  
      if func_name == "pdist":
          old_arg_names = ["p", "w", "V", "VI"]
      else:
          old_arg_names = ["p", "V", "VI", "w"]
  
      num_args = len(args)
      warnings.warn(
          "%d metric parameters have been passed as positional."
          "This will raise an error in a future version."
          "Please pass arguments as keywords(i.e., ARGNAME=ARGVALUE)"
          % num_args,
          DeprecationWarning,
      )
  
      if num_args > 4:
          raise ValueError(
              "Deprecated %s signature accepts only 4"
              "positional arguments (%s), %d given."
              % (func_name, ", ".join(old_arg_names), num_args)
          )
  
      for old_arg, arg in zip(old_arg_names, args):
          if old_arg in kwargs:
              raise TypeError(
                  "%s() got multiple values for argument %s"
                  % (func_name, old_arg)
              )
          kwargs[old_arg] = arg
      return 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 1 for calling a global function with example usage: _args_to_kwargs_xdist(args, kwargs, metric, func_name) and returns: kwargs, kwargs