def convert_to_py2():
    if source_dir == 'python2_source' and not PY2_CONVERTED:
        try:
            # Check if 3to2 exists
            subprocess.check_output(['3to2', '--help'])
            subprocess.check_output(['pasteurize', '--help'])
        except __HOLE__ as e:
            if e.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