docs: def calculate_error_by_annotation(graph: BELGraph, annotation: str) -> Mapping[str, List[str]]:
      """Group error names by a given annotation."""
      results = defaultdict(list)
  
      for _, exc, ctx in graph.warnings:
          if not ctx or not edge_has_annotation(ctx, annotation):
              continue
  
          values = ctx[ANNOTATIONS][annotation]
  
          if isinstance(values, str):
              results[values].append(exc.__class__.__name__)
  
          elif isinstance(values, Iterable):
              for value in values:
                  results[value].append(exc.__class__.__name__)
  
      return dict(results)