Now uses items() instead of iteritems() for 3.0 compatibility.