from typing import Dict


def update_dict(dic: Dict, key: str, new_v: int) -> Dict:
    """update nested dictionary key value with new_value

    Args:
        dic ([dict]): a nested dictionary with variant length
        key ([str]): key at any depth
        new_v ([int]): new value for same key of dic

    Returns:
        [dict]: dictionary with new value
    """
    for k, val in dic.items():
        if isinstance(val, dict):
            update_dict(val, key, new_v)

        if k == key:
            dic[k] = new_v
    return dic