def convert_to_lower(data):
 results = dict()
 if isinstance(data, dict):
  for (key, val) in data.items():
   key = re.sub('(([A-Z]{1,3}){1})', '_\\1', key).lower()
   if (key[0] == '_'):
    key = key[1:]
   if isinstance(val, datetime.datetime):
    results[key] = val.isoformat()
   elif isinstance(val, dict):
    results[key] = convert_to_lower(val)
   elif isinstance(val, list):
    converted = list()
    for item in val:
     converted.append(convert_to_lower(item))
    results[key] = converted
   else:
    results[key] = val
 return results

def convert_to_lower ( data ) : results = dict ( ) if isinstance ( data , dict ) : for ( key , val ) in data . items ( ) : key = re . sub ( '(([A-Z]{1,3}){1})' , '_\\1' , key ) . lower ( ) if ( key [ 0 ] == '_' ) : key = key [ 1 : ] if isinstance ( val , datetime . datetime ) : results [ key ] = val . isoformat ( ) elif isinstance ( val , dict ) : results [ key ] = convert_to_lower ( val ) elif isinstance ( val , list ) : converted = list ( ) for item in val : converted . append ( convert_to_lower ( item ) ) results [ key ] = converted else : results [ key ] = val return results
convert all uppercase keys in dict with lowercase_ args: data : dictionary with keys that have upper cases in them example .