for k, v in dic.items():
converted_key = func(k)
if converted_key == k: continue
dic.pop(k)
if type(v) is dict:
dic[converted_key] = convert_dict_keys(func, v)
After Change
converted by `func`.
out_dict = dict()
for k, v in in_dict.items():
converted_key = func(k)
if type(v) is dict:
out_dict[converted_key] = convert_dict_keys(func, v)
else:
out_dict[converted_key] = v
return out_dict