Pick off the low hanging fruit

This fixes most of the import errors that came from using the
implicit relative imports that Python 2 supports.  This also fixes
the use of `xrange`, which has replaced `range` in Python 3.  The
same has happened for `izip`, which is also being aliased.

The octal number syntax changed in Python 3, so we are now
converting from strings using the `int` built-in function, which
will produce the same output across both versions of Python.