Maybe a detail, but prefer items() above iteritems(), unless you want to have a generator object in Python2.7. In Python3, items() is automatically a generator.