change iteritems to items for py2.x and py3.x