code: def _load_function(context, func_spec, spec_version):
      if not isinstance(func_spec, pm.Function):
          raise TypeError("Invalid Function spec object")
  
      if func_spec.attributes:
          raise ValueError("Attributes on functions not supported")
  
      func_inputs = {}
      for named_value_type in func_spec.inputs:
          name = named_value_type.name
          valuetype = proto_to_types(named_value_type.type)
  
          if not types.is_tensor(valuetype):
              raise ValueError("Functions inputs can only be tensors")
          func_inputs[name] = Placeholder(
              sym_shape=valuetype.get_shape(),
              dtype=valuetype.get_primitive(),
              name=name,
          )
          context.register_var_with_name(
              name, func_inputs[name].outputs[0]
          )
  
      opset = func_spec.opset
      if opset not in func_spec.block_specializations:
          raise ValueError(
              "Missing block specialization for opset {}".format(opset)
          )
  
      with Function(
          func_inputs, opset_version=_target(spec_version)
      ) as pymil_func:
          _load_block(context, func_spec.block_specializations[opset])
  
      return pymil_func
  
imports: import os
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.backend.mil import helper
  from coremltools.converters.mil.mil import Block
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, ListVar, Placeholder, Program, TupleInputType, Var, mil_list, types
  from coremltools.converters.mil.mil.block import curr_block
  from coremltools.converters.mil.mil.ops.registry import SSAOpRegistry
  from coremltools.proto import MIL_pb2
  from coremltools.proto import Model_pb2
  from .helper import proto_to_types
label_desc: Use image node_id 12 for calling a global function with example usage: _load_function(context, func_spec, spec_version) and returns: pymil_func