iteritems is no longer an available method for dict in Python 3. Using
dict.items() is functionally identical, although it creates some overhead
for Python 2.7 (creation of a temporary list). As this is only called
when tracing, this is not a big issue. For Python 3, there is no
overhead (dict.items() returns an iterator).