from typing import Callable
from collections import OrderedDict


def map_to_keys(__func: Callable[[str], str], __dict: dict):
    result_dict = {}
    for key, value in __dict.items():
        if type(value) in (dict, OrderedDict):
            value = map_to_keys(__func, value)

        result_dict[__func(key)] = value

    return result_dict


def to_lower(__dict: dict):
    return map_to_keys(str.lower, __dict)


def to_upper(__dict: dict):
    return map_to_keys(str.upper, __dict)