code: def _mil_convert(
      model,
      convert_from,
      convert_to,
      registry,
      modelClass,
      compute_units,
      **kwargs,
  ):
      # Map "convert_to" values that correspond to the alias_names, to the actual supported registries
      if convert_to in registry.backend_alias_names:
          msg = "Please use '{}' instead of '{}' with the 'convert_to' argument. The latter will be removed in the future."
          _warnings.warn(
              msg.format(
                  registry.backend_alias_names[convert_to], convert_to
              )
          )
          convert_to = registry.backend_alias_names[convert_to]
  
      if convert_to == "mlprogram":
          # mil_convert_to_proto places weight files inside the weights_dir
          weights_dir = _tempfile.TemporaryDirectory()
          kwargs["weights_dir"] = weights_dir.name
  
      proto, mil_program = mil_convert_to_proto(
          model, convert_from, convert_to, registry, **kwargs
      )
  
      _reset_conversion_state()
  
      if convert_to == "milinternal":
          return mil_program  # mil program
      elif convert_to == "milpython":
          return proto  # internal mil data structure
  
      elif convert_to == "mlprogram":
          package_path = _create_mlpackage(
              proto,
              kwargs.get("weights_dir"),
              kwargs.get("package_dir"),
          )
          return modelClass(
              package_path,
              is_temp_package=not kwargs.get("package_dir"),
              mil_program=mil_program,
              skip_model_load=kwargs.get("skip_model_load", False),
              compute_units=compute_units,
          )
  
      return modelClass(
          proto,
          mil_program=mil_program,
          skip_model_load=kwargs.get("skip_model_load", False),
          compute_units=compute_units,
      )
  
imports: import tempfile
  import warnings
  from typing import Optional, Text, Tuple
  from coremltools.converters._profile_utils import _profile
  from coremltools.converters.mil import Program
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.types.symbolic import k_num_internal_syms, k_used_symbols
  from coremltools.models import MLModel
  from coremltools.models.model import _create_mlpackage
  from .None import ImageType, InputType
  from .mil.passes.pass_pipeline import PassPipeline, PassPipelineManager
label_desc: Use image node_id 3 for calling a global function with example usage: _mil_convert(model, convert_from, convert_to, registry, modelClass, compute_units) and returns: modelClass, mil_program, proto, modelClass