code: def instantiate_steppers(
      model: Model,
      steps: List[Step],
      selected_steps: Mapping[Type[BlockedStep], List[Any]],
      step_kwargs: Optional[Dict[str, Dict]] = None,
  ) -> Union[Step, List[Step]]:
      """Instantiate steppers assigned to the model variables.
  
      This function is intended to be called automatically from ``sample()``, but
      may be called manually.
  
      Parameters
      ----------
      model : Model object
          A fully-specified model object.
      steps : list, array_like of shape (selected_steps, )
          A list of zero or more step function instances that have been assigned to some subset of
          the model's parameters.
      selected_steps : dict
          A dictionary that maps a step method class to a list of zero or more model variables.
      step_kwargs : dict, default=None
          Parameters for the samplers. Keys are the lower case names of
          the step method, values a dict of arguments. Defaults to None.
  
      Returns
      -------
      methods : list or step
          List of step methods associated with the model's variables, or step method
          if there is only one.
      """
      if step_kwargs is None:
          step_kwargs = {}
  
      used_keys = set()
      for step_class, vars in selected_steps.items():
          if vars:
              name = getattr(step_class, "name")
              args = step_kwargs.get(name, {})
              used_keys.add(name)
              step = step_class(vars=vars, model=model, **args)
              steps.append(step)
  
      unused_args = set(step_kwargs).difference(used_keys)
      if unused_args:
          s = "s" if len(unused_args) > 1 else ""
          example_arg = sorted(unused_args)[0]
          example_step = (
              list(selected_steps.keys()) or pm.STEP_METHODS
          )[0]
          example_step_name = getattr(example_step, "name")
          raise ValueError(
              f"Invalid key{s} found in step_kwargs: {unused_args}. "
              "Keys must be step names and values valid kwargs for that stepper. "
              f'Did you mean {{"{example_step_name}": {{"{example_arg}": ...}}}}?'
          )
  
      if len(steps) == 1:
          return steps[0]
  
      return steps
  
imports: import logging
  import pickle
  import sys
  import time
  import warnings
  from typing import Any, Dict, Iterator, List, Literal, Mapping, Optional, Sequence, Set, Tuple, Type, Union, overload
  import numpy
  import pytensor.gradient
  from arviz import InferenceData, dict_to_dataset
  from arviz.data.base import make_attrs
  from fastprogress.fastprogress import progress_bar
  from pytensor.graph.basic import Variable
  from typing_extensions import Protocol, TypeAlias
  import pymc
  from pymc.backends import RunType, TraceOrBackend, init_traces
  from pymc.backends.arviz import coords_and_dims_for_inferencedata, find_constants, find_observations
  from pymc.backends.base import IBaseTrace, MultiTrace, _choose_chains
  from pymc.blocking import DictToArrayBijection
  from pymc.exceptions import SamplingError
  from pymc.initial_point import PointType, StartDict, make_initial_point_fns_per_chain
  from pymc.model import Model, modelcontext
  from pymc.sampling.parallel import Draw, _cpu_count
  from pymc.sampling.population import _sample_population
  from pymc.stats.convergence import log_warning_stats, log_warnings, run_convergence_checks
  from pymc.step_methods import NUTS, CompoundStep
  from pymc.step_methods.arraystep import BlockedStep, PopulationArrayStepShared
  from pymc.step_methods.hmc import quadpotential
  from pymc.util import RandomSeed, RandomState, _get_seeds_per_chain, drop_warning_stat, get_untransformed_name, is_transformed_name
  from pymc.vartypes import discrete_types
label_desc: Use image node_id 1 for calling a global function with example usage: instantiate_steppers(model, steps, selected_steps, step_kwargs) and returns: steps, steps