Replace iteritems() with items()
Remove old exception syntax
Remove exception indexing
Fix hexadecimal notation
Replace xrange() with range()
Wrap keys() and values() in list() for Python 3
Remove unused import
Remove unused except clause