Fixed python3 compatibility issue with use of six.iteritems.