def key_tuple_value_nested_generator(dict_obj):
    """Recursively iterate over key-tuple-value pairs of nested dictionaries.

    Parameters
    ----------
    dict_obj : dict
        The outer-most dict to iterate on.

    Returns
    -------
    generator
        A generator over key-tuple-value pairs in all nested dictionaries.

    Example
    -------
    >>> dicti = {'a': 1, 'b': {'c': 3, 'd': 4}}
    >>> print(sorted(list(key_tuple_value_nested_generator(dicti))))
    [(('a',), 1), (('b', 'c'), 3), (('b', 'd'), 4)]
    """
    for key, value in dict_obj.items():
        if isinstance(value, dict):
            for nested_key, value in key_tuple_value_nested_generator(value):
                yield tuple([key]) + nested_key, value
        else:
            yield tuple([key]), value
Recursively iterate over key-tuple-value pairs of nested dictionaries.

    Parameters
    ----------
    dict_obj : dict
        The outer-most dict to iterate on.

    Returns
    -------
    generator
        A generator over key-tuple-value pairs in all nested dictionaries.

    Example
    -------
    >>> dicti = {'a': 1, 'b': {'c': 3, 'd': 4}}
    >>> print(sorted(list(key_tuple_value_nested_generator(dicti))))
    [(('a',), 1), (('b', 'c'), 3), (('b', 'd'), 4)]