Fixed #21883 -- Added six.moves.xrange import

When moving code around from sql.where to lookups six.moves.xrange
import was forgotten. The xrange import is needed on Python 3.