def METHOD_NAME(namespace_nests, local_envs):
    for k, v in local_envs.items():
        if isinstance(v, dict):
            nests = copy.deepcopy(namespace_nests)
            nests.append(k)
            METHOD_NAME(nests, v)
        else:
            global_k = ".".join(namespace_nests + [k])
            all_flattens[global_k] = v