code: def promoted_primitive_type(type1, type2):
      """
      Given a pair of tensor or primitive types, find the smallest type that can store an instance
      of their primitive type.
      """
      ptype1 = (
          type1.get_primitive() if types.is_tensor(type1) else type1
      )
      ptype2 = (
          type2.get_primitive() if types.is_tensor(type2) else type2
      )
      return types.promote_types(ptype1, ptype2)
  
imports: import math
  import numbers
  from typing import List, Tuple
  import numpy
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Var, get_new_symbol, types
  from coremltools.converters.mil.mil.ops.defs.iOS15.elementwise_unary import cast
  from coremltools.converters.mil.mil.types import builtin_to_string, promote_dtypes
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
label_desc: Use image node_id 3 for calling a global function with example usage: promoted_primitive_type(type1, type2) and returns: types