six.advance_iterator -> next
diff --git a/jinja2/_compat.py b/jinja2/_compat.py
index 6318f0b..7825cb6 100644
--- a/jinja2/_compat.py
+++ b/jinja2/_compat.py
@@ -11,6 +11,7 @@
     :copyright: Copyright 2013 by the Jinja team, see AUTHORS.
     :license: BSD, see LICENSE for details.
 """
+import six
 
 # https://bitbucket.org/gutworth/six/issue/25/add-unichr
 try:
@@ -18,7 +19,6 @@
 except NameError:
     unichr = chr  # py3
 
-try:
-    range_type = xrange
-except NameError:
-    range_type = range
+range_type = six.moves.xrange
+next = six.advance_iterator
+imap = six.moves.map