def mangle_compatibility_messages(validation):
 compat = validation['compatibility_summary']
 for k in ('errors', 'warnings', 'notices'):
  validation[k] = compat[k]
 for msg in validation['messages']:
  if msg['compatibility_type']:
   msg['type'] = msg['compatibility_type']

def mangle_compatibility_messages ( validation ) : compat = validation [ 'compatibility_summary' ] for k in ( 'errors' , 'warnings' , 'notices' ) : validation [ k ] = compat [ k ] for msg in validation [ 'messages' ] : if msg [ 'compatibility_type' ] : msg [ 'type' ] = msg [ 'compatibility_type' ]
mangle compatibility messages so that the message type matches the compatibility type .