Fix use of xrange with Python 3
Merge pull request #1884 from astrofrog/fix-xrange

Fix use of xrange with Python 3