Correct import
Replace print statements with logging

--HG--
extra : amend_source : 7e392065357631acbd71f59d67783e07a195fdf1
Use modern syntax for raising Exceptions.
Use range instead of xrange.
Remove questionnable code and only reference to deprecated __builtin__ module.
Remove 2to3. Project now imports on Python 3 without conversion.
Replace use of 'iteritems' with six.iteritems