code: def promote_dtypes(dtypes):
      """
      Get the smallest promoted dtype, to which all scalar dtypes (provided through dtypes list argument) can be casted.
      Args:
          List [dtype (builtin)]
      Returns:
          A builtin datatype or None.
  
      Examples:
          >>> promote_dtypes([int32, int64, int16])
              builtin('int64')
  
          >>> promote_dtypes([fp16, fp32, fp64])
              builtin('fp64')
  
          >>> promote_dtypes([fp16, int32, int64])
              builtin('fp16')
  
      """
      if not isinstance(dtypes, (list, tuple)) or len(dtypes) < 1:
          raise ValueError(
              "dtypes needs to be a list/tuple of at least 1 element"
          )
  
      # Deduplicate inputs to avoid redundant calculations.
      # Without dedup, too large input will cause maximum recursion depth exceeded error.
      dtypes = list(set(dtypes))
  
      if len(dtypes) == 1:
          return dtypes[0]
  
      return promote_types(dtypes[0], promote_dtypes(dtypes[1:]))
  
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 9 for calling a global function with example usage: promote_dtypes(dtypes) and returns: promote_types, dtypes