Using xrange instead of range for Python 2