code: def promote_types(dtype1, dtype2):
      """
      Get the smallest type to which the given scalar types can be cast.
  
      Args:
          dtype1 (builtin):
          dtype2 (builtin):
  
      Returns:
          A builtin datatype or None.
  
      Examples:
          >>> promote_types(int32, int64)
              builtin('int64')
  
          >>> promote_types(fp16, fp32)
              builtin('fp32')
  
          >>> promote_types(fp16, int32)
              builtin('fp16')
      """
      nptype1 = nptype_from_builtin(dtype1)
      nptype2 = nptype_from_builtin(dtype2)
      # Circumvent the undesirable np type promotion:
      # >> np.promote_types(np.float32, np.int32)
      # dtype('float64')
      if np.issubdtype(nptype1, np.floating) and np.issubdtype(
          nptype2, np.signedinteger
      ):
          nppromoted = nptype1
      elif np.issubdtype(nptype2, np.floating) and np.issubdtype(
          nptype1, np.signedinteger
      ):
          nppromoted = nptype2
      else:
          nppromoted = np.promote_types(nptype1, nptype2)
      return numpy_type_to_builtin_type(nppromoted)
  
imports: from collections import namedtuple
  import numpy
  import numpy
  import sympy
  import coremltools.proto.MIL_pb2
  from .get_type_info import get_type_info
  from .type_bool import bool
  from .type_bool import is_bool
  from .type_complex import complex64
  from .type_complex import complex128
  from .type_complex import is_complex
  from .type_dict import is_dict
  from .type_double import fp16
  from .type_double import fp32
  from .type_double import fp64
  from .type_double import is_float
  from .type_int import int8
  from .type_int import int16
  from .type_int import int32
  from .type_int import int64
  from .type_int import is_int
  from .type_int import uint8
  from .type_int import uint16
  from .type_int import uint32
  from .type_int import uint64
  from .type_list import is_list
  from .type_str import str
  from .type_unknown import unknown
label_desc: Use image node_id 8 for calling a global function with example usage: promote_types(dtype1, dtype2) and returns: numpy_type_to_builtin_type