Py3 fix: don't use xrange in scan template.