iteritems is deprecated for python 2, and unavailable for python 3. A such, this implementation calls viewitems for python 2, and items on python 3, both of which are equivalent.