Change .iteritems to items for Python 3 compatibility