class _defaultdict(defaultdict):

    def __add__(self, other):
        return other

def CountTree():
    return _defaultdict(CountTree)
More Pythonic way of counting things in a heavily nested defaultdict