Cleaned up more imports and used 'six' to handle iteritems()
Cleaned up more imports.  Fixed exceptions.  Used 'six' for iteritems().