code: def _determine_source(
      model,
      source,
      output_names,
      outputs_as_tensor_or_image_types,
      output_argument_as_specified_by_user,
  ):
      """
      Infer source (which can be auto) to the precise framework.
      """
      source = source.lower()
      if source not in {"auto", "tensorflow", "pytorch", "milinternal"}:
          raise ValueError(
              f'Unrecognized value of argument "source": {source}. It must be one of ["auto", "tensorflow", "pytorch"].'
          )
  
      # Determine tensorflow version
      if source == "tensorflow" and _HAS_TF_2:
          return "tensorflow2"
  
      if source != "auto":
          return source
  
      # Determine `auto` source
      if source == "auto" and _HAS_TF_1:
          try:
              loader = TF1Loader(
                  model, outputs=outputs_as_tensor_or_image_types
              )
              loader._graph_def_from_model(output_names=output_names)
              return "tensorflow"
          except:
              pass
  
      if source == "auto" and _HAS_TF_2:
          try:
              loader = TF2Loader(
                  model, outputs=outputs_as_tensor_or_image_types
              )
              loader._graph_def_from_model(output_names=output_names)
              return "tensorflow2"
          except:
              pass
  
      if source == "auto" and _HAS_TORCH:
          if _HAS_TORCH_EXPORT_API and isinstance(
              model, ExportedProgram
          ):
              return "pytorch"
  
          is_torch_load_successful = False
          try:
              try_load_torchscript(model)
              is_torch_load_successful = True
          except:
              pass
          if is_torch_load_successful:
              # validate that the outputs passed by the user are of type ImageType/TensorType
              if (
                  output_argument_as_specified_by_user is not None
                  and not all(
                      [
                          isinstance(t, TensorType)
                          or isinstance(t, ImageType)
                          for t in output_argument_as_specified_by_user
                      ]
                  )
              ):
                  raise ValueError(
                      '"outputs" must be a list of type ct.TensorType or ct.ImageType '
                      "for pytorch conversion"
                  )
              return "pytorch"
  
      if source == "auto" and isinstance(model, Program):
          return "milinternal"
  
      msg = (
          "Unable to determine the type of the model, i.e. the source framework. "
          'Please provide the value of argument "source", from one of '
          '["tensorflow", "pytorch", "milinternal"]. Note that model conversion requires the '
          "source package that generates the model. Please make sure you have "
          "the appropriate version of source package installed. E.g., if you're "
          "converting model originally trained with TensorFlow 1.14, make sure "
          "you have `tensorflow==1.14` installed."
      )
      raise ValueError(msg)
  
imports: import collections
  import gc
  import os
  from typing import List, Optional, Text, Union
  from coremltools import _LOWEST_ALLOWED_SPECIFICATION_VERSION_FOR_MILPROGRAM, _LOWEST_ALLOWED_SPECIFICATION_VERSION_FOR_NEURALNETWORK
  from coremltools import ComputeUnit
  from coremltools import __version__
  from coremltools import _logger
  from coremltools._deps import _HAS_TF_1, _HAS_TF_2, _HAS_TORCH, _HAS_TORCH_EXPORT_API
  from coremltools.converters._profile_utils import _profile
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget, check_deployment_compatibility
  from coremltools.converters.mil.converter import mil_convert
  from coremltools.converters.mil.input_types import ClassifierConfig, EnumeratedShapes, ImageType, InputType, RangeDim, Shape, TensorType
  from coremltools.converters.mil.mil import Program, types
  from coremltools.converters.mil.mil.passes.defs.quantization import ComputePrecision
  from coremltools.converters.mil.mil.passes.defs.quantization import FP16ComputePrecision
  from coremltools.converters.mil.mil.passes.graph_pass import PassOption
  from coremltools.converters.mil.mil.passes.pass_pipeline import PassPipeline
  from coremltools.models import _METADATA_SOURCE, _METADATA_SOURCE_DIALECT, _METADATA_VERSION
  from coremltools.models.utils import _MLPACKAGE_EXTENSION
label_desc: Use image node_id 8 for calling a global function with example usage: _determine_source(model, source, output_names, outputs_as_tensor_or_image_types, output_argument_as_specified_by_user) and returns: str, source, str, str, str, str, str