use iteritems instead of items when iterating over dictionary