Fix usage of xrange for Python3