changed dict.iteritems() call to dict.items() for python 3 compatibility...