Fix NameError: global name 'xrange' is not defined on Python 3