code: def warn_population_size(
      *,
      step: Union[BlockedStep, CompoundStep],
      initial_points: Sequence[PointType],
      model: Model,
      chains: int,
  ):
      """Emit informative errors/warnings for dangerously small population size."""
      has_demcmc = np.any(
          [
              isinstance(m, DEMetropolis)
              for m in (
                  step.methods
                  if isinstance(step, CompoundStep)
                  else [step]
              )
          ]
      )
  
      initial_point_model_size = sum(
          initial_points[0][n.name].size for n in model.value_vars
      )
  
      if has_demcmc and chains < 3:
          raise ValueError(
              "DEMetropolis requires at least 3 chains. "
              "For this {}-dimensional model you should use ≥{} chains".format(
                  initial_point_model_size, initial_point_model_size + 1
              )
          )
      if has_demcmc and chains <= initial_point_model_size:
          warnings.warn(
              "DEMetropolis should be used with more chains than dimensions! "
              f"(The model has {initial_point_model_size} dimensions.)",
              UserWarning,
              stacklevel=2,
          )
      return
  
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 2 for calling a global function with example usage: warn_population_size() without return types