code: def _validate_metrics_dict(
      metrics: dict[str, dict[str, Any]]
  ) -> None:
      """Check the assumptions about metrics config dict.
  
      - Keys are metric names
      - Values are dictionaries.
      - Internal dictionaries:
          - have key "class_path" and its value is of type str
          - have key init_args" and its value is of type dict).
  
      """
      assert all(
          isinstance(metric, str) for metric in metrics.keys()
      ), f"All keys (metric names) must be strings, found {sorted(metrics.keys())}"
      assert all(
          isinstance(metric, (dict, DictConfig))
          for metric in metrics.values()
      ), f"All values must be dictionaries, found {list(metrics.values())}"
      assert all(
          "class_path" in metric
          and isinstance(metric["class_path"], str)
          for metric in metrics.values()
      ), (
          "All internal dictionaries must have a 'class_path' key whose value is of type str, "
          f"found {list(metrics.values())}"
      )
      assert all(
          "init_args" in metric
          and isinstance(metric["init_args"], (dict, DictConfig))
          for metric in metrics.values()
      ), (
          "All internal dictionaries must have a 'init_args' key whose value is of type dict, "
          f"found {list(metrics.values())}"
      )
  
imports: from __future__ import annotations
  import importlib
  import warnings
  from typing import Any
  import torchmetrics
  from omegaconf import DictConfig, ListConfig
  from .anomaly_score_distribution import AnomalyScoreDistribution
  from .anomaly_score_threshold import AnomalyScoreThreshold
  from .aupr import AUPR
  from .aupro import AUPRO
  from .auroc import AUROC
  from .collection import AnomalibMetricCollection
  from .min_max import MinMax
  from .optimal_f1 import OptimalF1
  from .pro import PRO
label_desc: Use image node_id 2 for calling a global function with example usage: _validate_metrics_dict(metrics) without return types