"""Helpers for python 2/3 compatibility"""

import sys

PY3 = sys.version_info[0] == 3


if PY3:
    import configparser as ConfigParser
else:
    import ConfigParser


if PY3:
    from urllib.parse import quote as url_quote
else:
    from urllib import quote as url_quote


if PY3:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse


if PY3:
    imap = map
else:
    from itertools import imap


xrange = range if PY3 else xrange

"""Helpers for python 2/3 compatibility"""

import sys

PY2 = sys.version_info[0] == 2


if not PY2:
    import configparser as ConfigParser
else:
    import ConfigParser


if not PY2:
    from urllib.parse import quote as url_quote
else:
    from urllib import quote as url_quote


if not PY2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse


if not PY2:
    imap = map
else:
    from itertools import imap


xrange = range if not PY2 else xrange

Use PY2 check instead of PY3 check.
Use PY2 check instead of PY3 check.

See http://lucumr.pocoo.org/2013/5/21/porting-to-python-3-redux/ for
details.

  """Helpers for python 2/3 compatibility"""
  
  import sys
  
- PY3 = sys.version_info[0] == 3
+ PY2 = sys.version_info[0] == 2
  
  
- if PY3:
+ if not PY2:
      import configparser as ConfigParser
  else:
      import ConfigParser
  
  
- if PY3:
+ if not PY2:
      from urllib.parse import quote as url_quote
  else:
      from urllib import quote as url_quote
  
  
- if PY3:
+ if not PY2:
      from urllib.parse import urlparse
  else:
      from urlparse import urlparse
  
  
- if PY3:
+ if not PY2:
      imap = map
  else:
      from itertools import imap
  
  
- xrange = range if PY3 else xrange
+ xrange = range if not PY2 else xrange
  
Use PY2 check instead of PY3 check.
## Code Before:
"""Helpers for python 2/3 compatibility"""

import sys

PY3 = sys.version_info[0] == 3


if PY3:
    import configparser as ConfigParser
else:
    import ConfigParser


if PY3:
    from urllib.parse import quote as url_quote
else:
    from urllib import quote as url_quote


if PY3:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse


if PY3:
    imap = map
else:
    from itertools import imap


xrange = range if PY3 else xrange

## Instruction:
Use PY2 check instead of PY3 check.
## Code After:
"""Helpers for python 2/3 compatibility"""

import sys

PY2 = sys.version_info[0] == 2


if not PY2:
    import configparser as ConfigParser
else:
    import ConfigParser


if not PY2:
    from urllib.parse import quote as url_quote
else:
    from urllib import quote as url_quote


if not PY2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse


if not PY2:
    imap = map
else:
    from itertools import imap


xrange = range if not PY2 else xrange
