Isn't this reimplementing `collections.defaultdict`?