from functools import reduce


def count_leaf_nodes(node):
    """Count the number of leaf nodes in a tree of nested dictionaries."""
    if not isinstance(node, dict):
        return 1
    else:
        return reduce(lambda x, y: x + y,
                      [count_leaf_nodes(node) for node in node.values()], 0)