Fix the range functions to use range instead of xrange. Althgough xrange is faster in python2, it is depracated in python3 with python3 range providing the same functionality as xrange.
Import the python3 print function for use in python2 interpreters.