A recursive constructor for defaultdict