code: def _format_rule_for_python_field(rule: _RuleType) -> str:
      snake_case_name = _kebab_case_to_snake_case(rule["name"])
      pascal_case_name = _kebab_case_to_pascal_case(rule["name"])
      short_description = rule["short_description"]["text"]
  
      return _PY_RULE_COLLECTION_FIELD_TEMPLATE.format(
          snake_case_name=snake_case_name,
          pascal_case_name=pascal_case_name,
          sarif_dict=rule,
          short_description=short_description,
      )
  
file_path: pytorch/tools/onnx/gen_diagnostics.py
imports: import argparse
  import os
  import string
  import subprocess
  import textwrap
  from typing import Any, Mapping, Sequence
  import yaml
  from torchgen import utils
  from torchgen.yaml_utils import YamlLoader
label_desc: Use image node_id 4 for calling a global function with example usage: _format_rule_for_python_field(rule) and returns: _PY_RULE_COLLECTION_FIELD_TEMPLATE