code: def _get_grouped_entry_points() -> dict[str, list[EPnD]]:
      mapping: dict[str, list[EPnD]] = defaultdict(list)
      for dist in metadata.distributions():
          try:
              for e in dist.entry_points:
                  mapping[e.group].append((e, dist))
          except Exception as e:
              log.warning(
                  "Error when retrieving package metadata (skipping it): %s, %s",
                  dist,
                  e,
              )
      return mapping
  
imports: from __future__ import annotations
  import functools
  import logging
  from collections import defaultdict
  from typing import Iterator, Tuple
label_desc: Use image node_id 1 for calling a global function with example usage: _get_grouped_entry_points() and returns: mapping