code: def _iter_population(
      *,
      draws: int,
      tune: int,
      popstep: PopulationStepper,
      steppers,
      traces: Sequence[BaseTrace],
      points,
  ) -> Iterator[int]:
      """Iterate a ``PopulationStepper``.
  
      Parameters
      ----------
      draws : int
          number of draws per chain
      tune : int
          number of tuning steps
      popstep : PopulationStepper
          the helper object for (parallelized) stepping of chains
      steppers : list
          The step methods for each chain
      traces : list
          Traces for each chain
      points : list
          population of chain states
  
      Yields
      ------
      i
          Iteration number.
      """
      try:
          with popstep:
              # iterate draws of all chains
              for i in range(draws):
                  # this call steps all chains and returns a list of (point, stats)
                  # the `popstep` may interact with subprocesses internally
                  updates = popstep.step(i == tune, points)
  
                  # apply the update to the points and record to the traces
                  for c, strace in enumerate(traces):
                      points[c], stats = updates[c]
                      strace.record(points[c], stats)
                      log_warning_stats(stats)
                  # yield the state of all chains in parallel
                  yield i
      except KeyboardInterrupt:
          for c, strace in enumerate(traces):
              strace.close()
              if hasattr(steppers[c], "report"):
                  steppers[c].report._finalize(strace)
          raise
      except BaseException:
          for c, strace in enumerate(traces):
              strace.close()
          raise
      else:
          for c, strace in enumerate(traces):
              strace.close()
              if hasattr(steppers[c], "report"):
                  steppers[c].report._finalize(strace)
  
imports: import logging
  import warnings
  from copy import copy
  from typing import Iterator, List, Sequence, Tuple, Union
  import cloudpickle
  import numpy
  from fastprogress.fastprogress import progress_bar
  from typing_extensions import TypeAlias
  from pymc.backends.base import BaseTrace
  from pymc.initial_point import PointType
  from pymc.model import Model, modelcontext
  from pymc.stats.convergence import log_warning_stats
  from pymc.step_methods import CompoundStep
  from pymc.step_methods.arraystep import BlockedStep, PopulationArrayStepShared, StatsType
  from pymc.step_methods.metropolis import DEMetropolis
  from pymc.util import RandomSeed
label_desc: Use image node_id 4 for calling a global function with example usage: _iter_population() without return types