Use collections.defaultdict.

<tt>collections.defaultdict</tt> is a Pythonic way to do this job.