code: def _set_datatype(
      proto_type_obj,
      datatype_instance,
      array_datatype=Model_pb2.ArrayFeatureType.DOUBLE,
  ):
      # Remap so we can still use the python types for the simple cases
      global _simple_type_remap
      if datatype_instance in _simple_type_remap:
          datatype_instance = _simple_type_remap[datatype_instance]
  
      # Now set the protobuf from this interface.
      if isinstance(datatype_instance, Int64):
          proto_type_obj.int64Type.MergeFromString(b"")
  
      elif isinstance(datatype_instance, Double):
          proto_type_obj.doubleType.MergeFromString(b"")
  
      elif isinstance(datatype_instance, String):
          proto_type_obj.stringType.MergeFromString(b"")
  
      elif isinstance(datatype_instance, Array):
          proto_type_obj.multiArrayType.MergeFromString(b"")
          proto_type_obj.multiArrayType.dataType = array_datatype
  
          for n in datatype_instance.dimensions:
              proto_type_obj.multiArrayType.shape.append(n)
  
      elif isinstance(datatype_instance, Dictionary):
          proto_type_obj.dictionaryType.MergeFromString(b"")
  
          kt = datatype_instance.key_type
  
          if isinstance(kt, Int64):
              proto_type_obj.dictionaryType.int64KeyType.MergeFromString(
                  b""
              )
          elif isinstance(kt, String):
              proto_type_obj.dictionaryType.stringKeyType.MergeFromString(
                  b""
              )
          else:
              raise ValueError(
                  "Dictionary key type must be either string or int."
              )
  
      else:
          raise TypeError(
              "Datatype parameter not recognized; must be an instance "
              "of datatypes.{Double, Int64, String, Dictionary, Array}, or "
              "python int, float, or str types."
          )
  
imports: import numpy
  from ..proto import Model_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: _set_datatype(proto_type_obj, datatype_instance, array_datatype) without return types