Fix python3 compatibility.

Use dict.items() instead of dict.iteritems().