def keys_to_string(data):
 if isinstance(data, dict):
  for key in list(data.keys()):
   if isinstance(key, six.string_types):
    value = data[key]
    val = keys_to_string(value)
    del data[key]
    data[key.encode('utf8', 'ignore')] = val
 return data

def keys_to_string ( data ) : if isinstance ( data , dict ) : for key in list ( data . keys ( ) ) : if isinstance ( key , six . string_types ) : value = data [ key ] val = keys_to_string ( value ) del data [ key ] data [ key . encode ( 'utf8' , 'ignore' ) ] = val return data
function to convert all the unicode keys in string keys .