code: def _validate_qmc_input(qmc_engine, d, seed):
      # Input validation for `qmc_engine` and `d`
      # Error messages for invalid `d` are raised by QMCEngine
      # we could probably use a stats.qmc.check_qrandom_state
      if isinstance(qmc_engine, QMCEngine):
          if d is not None and qmc_engine.d != d:
              message = "`d` must be consistent with dimension of `qmc_engine`."
              raise ValueError(message)
          d = qmc_engine.d if d is None else d
      elif qmc_engine is None:
          d = 1 if d is None else d
          qmc_engine = Halton(d, seed=seed)
      else:
          message = (
              "`qmc_engine` must be an instance of "
              "`scipy.stats.qmc.QMCEngine` or `None`."
          )
          raise ValueError(message)
  
      return qmc_engine, d
  
imports: import math
  import numbers
  import numpy
  from scipy import stats
  from scipy import special
  from ._qmc import check_random_state, Halton, QMCEngine
  from ._unuran.unuran_wrapper import NumericalInversePolynomial
  from scipy._lib._util import check_random_state
label_desc: Use image node_id 24 for calling a global function with example usage: _validate_qmc_input(qmc_engine, d, seed) and returns: qmc_engine,  d