code: def describe_statistics(stats_dict):
      """Return a multi-line string describing the passed run statistics.
  
      `stats_dict` must be a dictionary of data in the format collected by
      `hypothesis.internal.conjecture.engine.ConjectureRunner.statistics`.
  
      We DO NOT promise that this format will be stable or supported over
      time, but do aim to make it reasonably useful for downstream users.
      It's also meant to support benchmarking for research purposes.
  
      This function is responsible for the report which is printed in the
      terminal for our pytest --hypothesis-show-statistics option.
      """
      lines = (
          [stats_dict["nodeid"] + ":\n"]
          if "nodeid" in stats_dict
          else []
      )
      prev_failures = 0
      for phase in (p.name for p in list(Phase)[1:]):
          d = stats_dict.get(phase + "-phase", {})
          # Basic information we report for every phase
          cases = d.get("test-cases", [])
          if not cases:
              continue
          statuses = Counter(t["status"] for t in cases)
          runtime_ms = format_ms(t["runtime"] for t in cases)
          drawtime_ms = format_ms(t["drawtime"] for t in cases)
          lines.append(
              f"  - during {phase} phase ({d['duration-seconds']:.2f} seconds):\n"
              f"    - Typical runtimes: {runtime_ms}, of which {drawtime_ms} in data generation\n"
              f"    - {statuses['valid']} passing examples, {statuses['interesting']} "
              f"failing examples, {statuses['invalid'] + statuses['overrun']} invalid examples"
          )
          # If we've found new distinct failures in this phase, report them
          distinct_failures = d["distinct-failures"] - prev_failures
          if distinct_failures:
              plural = distinct_failures > 1
              lines.append(
                  "    - Found {}{} distinct error{} in this phase".format(
                      distinct_failures,
                      " more" * bool(prev_failures),
                      "s" * plural,
                  )
              )
          prev_failures = d["distinct-failures"]
          # Report events during the generate phase, if there were any
          if phase == "generate":
              events = Counter(sum((t["events"] for t in cases), []))
              if events:
                  lines.append("    - Events:")
                  lines += [
                      f"      * {100 * v / len(cases):.2f}%, {k}"
                      for k, v in sorted(
                          events.items(), key=lambda x: (-x[1], x[0])
                      )
                  ]
          # Some additional details on the shrinking phase
          if phase == "shrink":
              lines.append(
                  "    - Tried {} shrinks of which {} were successful".format(
                      len(cases), d["shrinks-successful"]
                  )
              )
          lines.append("")
  
      target_lines = describe_targets(stats_dict.get("targets", {}))
      if target_lines:
          lines.append("  - " + target_lines[0])
          lines.extend("    " + l for l in target_lines[1:])
      lines.append(
          "  - Stopped because " + stats_dict["stopped-because"]
      )
      return "\n".join(lines)
  
file_path: catboost/contrib/python/hypothesis/py3/hypothesis/statistics.py
imports: import math
  from collections import Counter
  from hypothesis._settings import Phase
  from hypothesis.utils.dynamicvariables import DynamicVariable
label_desc: Use image node_id 4 for calling a global function with example usage: describe_statistics(stats_dict) and returns: str