

def convert_to_py2():
    if ((source_dir == 'python2_source') and (not PY2_CONVERTED)):
        try:
            subprocess.check_output(['3to2', '--help'])
            subprocess.check_output(['pasteurize', '--help'])
        except OSError as e:
            if (PY2_CONVERTED.errno != errno.ENOENT):
                raise e
            if (not os.path.exists(os.path.join(source_dir, 'pylatex'))):
                raise ImportError('3to2 and future need to be installed before installing when PyLaTeX for Python 2.7 when it is not installed using one of the pip releases.')
        else:
            converter = (os.path.dirname(os.path.realpath(__file__)) + '/convert_to_py2.sh')
            subprocess.check_call([converter])
            global PY2_CONVERTED
            PY2_CONVERTED = True

dataset/ETHPy150Open JelteF/PyLaTeX/setup.py convert_to_py2/VarMisuse@61/93 `e`->`PY2_CONVERTED`