try:
    from urlparse import urlparse
except ImportError: # Python3
    from urllib import parse as urlparse

try:
    _xrange = xrange
except NameError:
    _xrange = range

try:
    from urlparse import urlparse
except ImportError: # Python3
    from urllib.parse import urlparse

try:
    _xrange = xrange
except NameError:
    _xrange = range

Fix compat module for Python 3
Fix compat module for Python 3
