def widest_numeric_type(type1, type2):
 if type1.is_reference:
  type1 = type1.ref_base_type
 if type2.is_reference:
  type2 = type2.ref_base_type
 if (type1 == type2):
  widest_type = type1
 elif (type1.is_complex or type2.is_complex):
  def real_type(ntype):
   if ntype.is_complex:
    return ntype.real_type
   return ntype
  widest_type = CComplexType(widest_numeric_type(real_type(type1), real_type(type2)))
 elif (type1.is_enum and type2.is_enum):
  widest_type = c_int_type
 elif (type1.rank < type2.rank):
  widest_type = type2
 elif (type1.rank > type2.rank):
  widest_type = type1
 elif (type1.signed < type2.signed):
  widest_type = type1
 elif (type1.signed > type2.signed):
  widest_type = type2
 elif (type1.is_typedef > type2.is_typedef):
  widest_type = type1
 else:
  widest_type = type2
 return widest_type

def widest_numeric_type ( type1 , type2 ) : if type1 . is_reference : type1 = type1 . ref_base_type if type2 . is_reference : type2 = type2 . ref_base_type if ( type1 == type2 ) : widest_type = type1 elif ( type1 . is_complex or type2 . is_complex ) : def real_type ( ntype ) : if ntype . is_complex : return ntype . real_type return ntype widest_type = CComplexType ( widest_numeric_type ( real_type ( type1 ) , real_type ( type2 ) ) ) elif ( type1 . is_enum and type2 . is_enum ) : widest_type = c_int_type elif ( type1 . rank < type2 . rank ) : widest_type = type2 elif ( type1 . rank > type2 . rank ) : widest_type = type1 elif ( type1 . signed < type2 . signed ) : widest_type = type1 elif ( type1 . signed > type2 . signed ) : widest_type = type2 elif ( type1 . is_typedef > type2 . is_typedef ) : widest_type = type1 else : widest_type = type2 return widest_type
given two numeric types .