def fix_attribute_names(payload, api_model):
 data = payload.copy()
 for key in payload:
  if api_model[key].attribute:
   data[api_model[key].attribute] = data[key]
   del data[key]
 return data

def fix_attribute_names ( payload , api_model ) : data = payload . copy ( ) for key in payload : if api_model [ key ] . attribute : data [ api_model [ key ] . attribute ] = data [ key ] del data [ key ] return data
converts payload fields to their real names .