Python: fix Python 3 compatibility
Python: fix Python 3 compatibility

Added `sys` import and bound `xrange` to `range` in case in case the
Python version in use is version 3 or greater.

thumbtack/abba,thumbtack/abba,thumbtack/abba