(nested_dict)
return result
Given a nested dictionary from k1 -> k2 > value
    transpose its outer and inner keys so it maps
    k2 -> k1 -> value.
Given a nested dictionary from k1 -> k2 > value
    transpose its outer and inner keys so it maps
    k2 -> k1 -> value.
Given a nested dictionary from k1 - > k2 > value transpose its outer and inner keys so it maps k2 - > k1 - > value .
def transpose_nested_dictionary(nested_dict):
    """
    Given a nested dictionary from k1 -> k2 > value
    transpose its outer and inner keys so it maps
    k2 -> k1 -> value.
    """
    result = defaultdict(dict)
    for k1, d in nested_dict.items():
        for k2, v in d.items():
            result[k2][k1] = v
    return result
def transpose_nested_dictionary ( nested_dict ) : result = defaultdict ( dict ) for k1 , d in nested_dict . items ( ) : for k2 , v in d . items ( ) : result [ k2 ] [ k1 ] = v return result