import copy


def regularize_dict_key(input_dict: dict, target_chr: str, replace_chr: str) -> dict:
    """recursively replace target character in keys with desired one. Return a new dictionary.

    Parameters
    ----------
    input_dict : dict
        a dictionary going to be cleaned. it can be nested
    target_chr : str
        character that will be replaced
    replace_chr : str
        character that is going to replace target character
    """
    dct = dict()
    for k, v in copy.deepcopy(input_dict).items():
        if isinstance(k, str) and target_chr in k:
            print(
                "replacing character {} with character {} "
                "in dictionary".format(target_chr, replace_chr)
            )
            k = k.replace(target_chr, replace_chr)
        if isinstance(v, dict):
            v = regularize_dict_key(v, target_chr, replace_chr)
        dct[k] = v
    return dct