code: def _make_test_model_gen_version(
      graph: GraphProto, **kwargs: Any
  ) -> ModelProto:
      latest_onnx_version, latest_ml_version, latest_training_version = onnx.helper.VERSION_TABLE[-1][2:5]  # type: ignore
      if "opset_imports" in kwargs:
          for opset in kwargs["opset_imports"]:
              # If the test model uses an unreleased opset version (latest_version+1),
              # directly use make_model to create a model with the latest ir version
              if (
                  (
                      (opset.domain in {"", "ai.onnx"})
                      and opset.version == latest_onnx_version + 1
                  )
                  or (
                      opset.domain == "ai.onnx.ml"
                      and opset.version == latest_ml_version + 1
                  )
                  or (
                      (
                          opset.domain
                          in {
                              "ai.onnx.training version",
                              "ai.onnx.preview.training",
                          }
                      )
                      and opset.version == latest_training_version + 1
                  )
              ):
                  return onnx.helper.make_model(graph, **kwargs)
      # Otherwise, find and use the corresponding ir version according to given opset version
      return onnx.helper.make_model_gen_version(graph, **kwargs)
  
file_path: onnx/onnx/backend/test/case/node/__init__.py
imports: import subprocess
  import sys
  from copy import deepcopy
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  import onnx
  from onnx.backend.test.case.test_case import TestCase
  from onnx.backend.test.case.utils import import_recursive
  from onnx.onnx_pb import AttributeProto, FunctionProto, GraphProto, ModelProto, NodeProto, TensorProto, TypeProto
label_desc: Use image node_id 5 for calling a global function with example usage: _make_test_model_gen_version(graph) and returns: onnx, onnx