code: def create_and_populate_onnx_test_case_with_model_conversion(
      model,
      tmpdir,
      name,
      loaded_model,
      resave=True,
      bypass_load_into_cntk=False,
      use_external_files_to_store_parameters=False,
  ):
      onnx_model = None
      test_model_path = os.path.join(str(tmpdir), R"test_" + name)
      os.mkdir(test_model_path)
      test_data_path = os.path.join(
          str(test_model_path), R"test_data_set_0"
      )
      os.mkdir(test_data_path)
      if not loaded_model:
          ## leave this line for debugging when needed
          ## plot original model
          # C.logging.graph.plot(model, os.path.join(str(test_model_path), name + ".pdf"))
  
          filename = os.path.join(str(test_model_path), name + R".onnx")
          model.save(
              filename,
              format=C.ModelFormat.ONNX,
              use_external_files_to_store_parameters=use_external_files_to_store_parameters,
          )
  
          loaded_model = C.Function.load(
              filename, format=C.ModelFormat.ONNX
          )
          onnx_model = onnx.load(filename)
  
          ## leave this line for debugging when needed
          # plot loaded model
          # C.logging.graph.plot(loaded_model, filename + ".pdf")
  
          if resave:
              filename_resave = os.path.join(
                  str(tmpdir), name + R"_resave.onnx"
              )
              loaded_model.save(
                  filename_resave, format=C.ModelFormat.ONNX
              )
      elif bypass_load_into_cntk:
          filename = os.path.join(str(test_model_path), name + R".onnx")
          model.save(
              filename,
              format=C.ModelFormat.ONNX,
              use_external_files_to_store_parameters=use_external_files_to_store_parameters,
          )
          onnx_model = onnx.load(filename)
  
      return loaded_model, onnx_model, test_model_path, test_data_path
  
imports: import os
  import re
  import shutil
  import numpy
  import scipy
  import cntk
  import pytest
  from .onnx_verify_helper import verify_results_with_onnxruntime, get_onnx_test_runner_callscript
label_desc: Use image node_id 9 for calling a global function with example usage: create_and_populate_onnx_test_case_with_model_conversion(model, tmpdir, name, loaded_model, resave, bypass_load_into_cntk, use_external_files_to_store_parameters) and returns: loaded_model,  onnx_model,  test_model_path,  test_data_path