code: def _record_build_metadata(
      mlmodel, exact_source, source_dialect=None
  ):
      # recording metadata: coremltools version, source framework and version
      if exact_source in {"tensorflow", "tensorflow2"} and (
          _HAS_TF_1 or _HAS_TF_2
      ):
          src_pkg_version = "tensorflow=={0}".format(tf.__version__)
      elif exact_source == "pytorch" and _HAS_TORCH:
          src_pkg_version = "torch=={0}".format(torch.__version__)
      elif exact_source == "milinternal":
          src_pkg_version = "milinternal"
      else:
          raise ValueError("Unsupported source {}".format(exact_source))
  
      mlmodel.user_defined_metadata[_METADATA_SOURCE] = src_pkg_version
      mlmodel.user_defined_metadata[_METADATA_VERSION] = _ct_version
  
      if source_dialect is not None:
          mlmodel.user_defined_metadata[
              _METADATA_SOURCE_DIALECT
          ] = source_dialect
  
      build_info = _get_metadata_from_mlmodel(mlmodel)
  
      mlmodel._set_build_info_mil_attributes(build_info)
  
      return mlmodel
  
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 11 for calling a global function with example usage: _record_build_metadata(mlmodel, exact_source, source_dialect) and returns: mlmodel