code: def convert(
      stem: str,
      package_name: str,
      output: str,
      do_onnx_ml: bool = False,
      lite: bool = False,
      protoc_path: str = "",
  ) -> None:
      proto_in = qualify(f"{stem}.in.proto")
      need_rename = package_name != DEFAULT_PACKAGE_NAME
      # Having a separate variable for import_ml ensures that the import statements for the generated
      # proto files can be set separately from the ONNX_ML environment variable setting.
      import_ml = do_onnx_ml
      # We do not want to generate the onnx-data-ml.proto files for onnx-data.in.proto,
      # as there is no change between onnx-data.proto and the ML version.
      if "onnx-data" in proto_in:
          do_onnx_ml = False
      if do_onnx_ml:
          proto_base = (
              f"{stem}_{package_name}-ml"
              if need_rename
              else f"{stem}-ml"
          )
      else:
          proto_base = (
              f"{stem}_{package_name}" if need_rename else f"{stem}"
          )
      proto = qualify(f"{proto_base}.proto", pardir=output)
      proto3 = qualify(f"{proto_base}.proto3", pardir=output)
  
      print(f"Processing {proto_in}")
      with open(proto_in, encoding="utf-8") as fin:
          source = fin.read()
          print(f"Writing {proto}")
          with open(proto, "w", newline="", encoding="utf-8") as fout:
              fout.write(autogen_header)
              fout.write(
                  translate(
                      source,
                      proto=2,
                      onnx_ml=import_ml,
                      package_name=package_name,
                  )
              )
              if lite:
                  fout.write(LITE_OPTION)
          print(f"Writing {proto3}")
          with open(proto3, "w", newline="", encoding="utf-8") as fout:
              fout.write(autogen_header)
              fout.write(
                  translate(
                      source,
                      proto=3,
                      onnx_ml=import_ml,
                      package_name=package_name,
                  )
              )
              if lite:
                  fout.write(LITE_OPTION)
          if protoc_path:
              porto3_dir = os.path.dirname(proto3)
              base_dir = os.path.dirname(porto3_dir)
              gen_proto3_code(
                  protoc_path, proto3, base_dir, base_dir, base_dir
              )
              pb3_files = glob.glob(
                  os.path.join(porto3_dir, f"{proto_base}.proto3.*")
              )
              for pb3_file in pb3_files:
                  print(f"Removing {pb3_file}")
                  os.remove(pb3_file)
  
          if need_rename:
              if do_onnx_ml:
                  proto_header = qualify(
                      f"{stem}-ml.pb.h", pardir=output
                  )
              else:
                  proto_header = qualify(f"{stem}.pb.h", pardir=output)
              print(f"Writing {proto_header}")
              with open(
                  proto_header, "w", newline="", encoding="utf-8"
              ) as fout:
                  fout.write("#pragma once\n")
                  fout.write(f'#include "{proto_base}.pb.h"\n')
  
      # Generate py mapping
      # "-" is invalid in python module name, replaces '-' with '_'
      pb_py = qualify(f"{stem.replace('-', '_')}_pb.py", pardir=output)
      if need_rename:
          pb2_py = qualify(
              f"{proto_base.replace('-', '_')}_pb2.py", pardir=output
          )
      else:  # noqa: PLR5501
          if do_onnx_ml:
              pb2_py = qualify(
                  f"{stem.replace('-', '_')}_ml_pb2.py", pardir=output
              )
          else:
              pb2_py = qualify(
                  f"{stem.replace('-', '_')}_pb2.py", pardir=output
              )
  
      print(f"generating {pb_py}")
      with open(pb_py, "w", encoding="utf-8") as f:
          f.write(
              dedent(
                  f"""\
                  # This file is generated by setup.py. DO NOT EDIT!
  
  
                  from .{os.path.splitext(os.path.basename(pb2_py))[0]} import *  # noqa
                  """
              )
          )
  
file_path: onnx/onnx/gen_proto.py
imports: import argparse
  import glob
  import os
  import re
  import subprocess
  from textwrap import dedent
  from typing import Iterable, Optional
label_desc: Use image node_id 7 for calling a global function with example usage: convert(stem, package_name, output, do_onnx_ml, lite, protoc_path) without return types