def convert_dict_keys(x, converter):
    """Recursively modifies dictionary keys by applying converter"""
    if isinstance(x, dict):
        new_dict = dict()
        for k, v in x.items():
            new_dict[converter(k)] = convert_dict_keys(v, converter)
        return new_dict
    elif isinstance(x, list):
        new_list = list()
        for item in x:
            new_list.append(convert_dict_keys(item, converter))
        return new_list
    else:
        return x