code: def _pretty_report(key_item, report):
      """
      Print a pretty report.
      """
      print(f"\n{color.PURPLE}{color.BOLD}{key_item}:{color.END}")
      metrics = {
          key: val
          for key, val in report.items()
          if key.startswith(key_item)
      }
      for metric, val in metrics.items():
          print(f"{color.BLUE}{metric.split(':')[-1]}:{color.END}")
          for key in sorted(list(val.keys())):
              v = val[key]
              assert v >= 0.0 and v <= 1.0
              if v <= 1 / 3:
                  v_col = color.GREEN
              elif v <= 2 / 3:
                  v_col = color.YELLOW
              else:
                  v_col = color.RED
              print(f"\t{key}: {v_col}{v * 100 :.2f}{color.END}")
  
file_path: ParlAI/projects/safety_bench/run_unit_tests.py
imports: from parlai.core.params import ParlaiParser
  from parlai.core.script import ParlaiScript
  import parlai.utils.logging
  from projects.safety_bench.utils.wrapper_loading import load_wrapper_module, setup_wrapper_registry, register_model_wrapper, MODEL_WRAPPER_REGISTRY
  from projects.safety_bench.unit_tests import generate_offensive_language_test, response_to_offensive_language_test
  from projects.safety_bench.utils.colors import color
  from projects.safety_bench.utils.perspective_api import get_perspective_api_key
  import os
  from typing import Optional
label_desc: Use image node_id 2 for calling a global function with example usage: _pretty_report(key_item, report) without return types