code: def warn_divergences(
      idata: arviz.InferenceData,
  ) -> List[SamplerWarning]:
      """Checks sampler stats and creates a list of warnings about divergences."""
      sampler_stats = idata.get("sample_stats", None)
      if sampler_stats is None:
          return []
  
      diverging = sampler_stats.get("diverging", None)
      if diverging is None:
          return []
  
      # Warn about divergences
      n_div = int(diverging.sum())
      if n_div == 0:
          return []
      warning = SamplerWarning(
          WarningType.DIVERGENCES,
          f"There were {n_div} divergences after tuning. Increase `target_accept` or reparameterize.",
          "error",
      )
      return [warning]
  
file_path: pymc/pymc/stats/convergence.py
imports: import dataclasses
  import enum
  import logging
  from typing import Any, Dict, List, Optional, Sequence
  import arviz
  from pymc.util import get_untransformed_name, is_transformed_name
label_desc: Use image node_id 2 for calling a global function with example usage: warn_divergences(idata) and returns: list, list, list, list