Use ```collections.defaultdict``` here instead of the try/except.