Python 3 compat imports.
Update to modern string formatting.
No unicodecsv package for Python 3.
Python 3 encoding fixes.
Use modern exception handler.
Support Python 2/3 abc.
Cast args to int.