code: def _validate_hamming_kwargs(X, m, n, **kwargs):
      w = kwargs.get("w", np.ones((n,), dtype="double"))
  
      if w.ndim != 1 or w.shape[0] != n:
          raise ValueError(
              "Weights must have same size as input vector. %d vs. %d"
              % (w.shape[0], n)
          )
  
      kwargs["w"] = _validate_weights(w)
      return kwargs
  
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 9 for calling a global function with example usage: _validate_hamming_kwargs(X, m, n) and returns: kwargs