# Buggy code
def get(cls, binary=None):
    # type: (Optional[str]) -> PythonIdentity

    # N.B.: We should not need to look past `sys.executable` to learn the current interpreter's
    # executable path, but on OSX there has been a bug where the `sys.executable` reported is
    # _not_ the path of the current interpreter executable:
    #   https://bugs.python.org/issue22490#msg283859
    # That case is distinguished by the presence of a `__PYVENV_LAUNCHER__` environment
    # variable as detailed in the Python bug linked above.
    if binary and binary != sys.executable and "__PYVENV_LAUNCHER__" not in os.environ:
        # Here we assume sys.executable is accurate and binary is something like a pyenv shim.
        binary = sys.executable

    supported_tags = tuple(tags.sys_tags())
    preferred_tag = supported_tags[0]
    return cls(
        binary=binary or sys.executable,
        python_tag=preferred_tag.interpreter,
        abi_tag=preferred_tag.abi,
        platform_tag=preferred_tag.platform,
        version=sys.version_info[:3],
        supported_tags=supported_tags,
        env_markers=markers.default_environment(),
    )


# Traceback (ModuleNotFoundError)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-kh23prp9/setup.py", line 59, in <module>
'Programming Language :: Python :: 3.8',
File "/root/.pex/pip.pex/aef609891d42d65c887d1aeee58c46f6713a7e49/.deps/setuptools/setuptools/__init__.py", line 169, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/root/.pex/pip.pex/aef609891d42d65c887d1aeee58c46f6713a7e49/.deps/wheel/wheel/bdist_wheel.py", line 228, in run
self.run_command('install')
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/root/.pex/pip.pex/aef609891d42d65c887d1aeee58c46f6713a7e49/.deps/setuptools/setuptools/command/install.py", line 65, in run
return orig.install.run(self)
File "/usr/lib/python3.7/distutils/command/install.py", line 601, in run
self.run_command(cmd_name)
File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/root/.pex/pip.pex/aef609891d42d65c887d1aeee58c46f6713a7e49/.deps/setuptools/setuptools/command/install_scripts.py", line 22, in run
import setuptools.command.easy_install as ei  # vendor:skip
File "/root/.pex/pip.pex/aef609891d42d65c887d1aeee58c46f6713a7e49/.deps/setuptools/setuptools/command/easy_install.py", line 69, in <module>
from setuptools.sandbox import run_setup  # vendor:skip
File "/root/.pex/pip.pex/aef609891d42d65c887d1aeee58c46f6713a7e49/.deps/setuptools/setuptools/sandbox.py", line 24, in <module>
import pkg_resources.py31compat  # vendor:skip
ModuleNotFoundError: No module named 'pkg_resources.py31compat'
----------------------------------------
ERROR: Failed building wheel for boto3

# Fixed code
def get(cls, binary=None):
    # type: (Optional[str]) -> PythonIdentity

    # N.B.: We should not need to look past `sys.executable` to learn the current interpreter's
    # executable path, but on OSX there has been a bug where the `sys.executable` reported is
    # _not_ the path of the current interpreter executable:
    #   https://bugs.python.org/issue22490#msg283859
    # That case is distinguished by the presence of a `__PYVENV_LAUNCHER__` environment
    # variable as detailed in the Python bug linked above.
    if binary and binary != sys.executable and "__PYVENV_LAUNCHER__" not in os.environ:
        # Here we assume sys.executable is accurate and binary is something like a pyenv shim.
        binary = sys.executable

    supported_tags = tuple(tags.sys_tags())
    preferred_tag = supported_tags[0]
    return cls(
        binary=binary or sys.executable,
        prefix=sys.prefix,
        base_prefix=(
            # Old virtualenv (16 series and lower) sets `sys.real_prefix` in all cases.
            getattr(sys, "real_prefix", None)
            # Both pyvenv and virtualenv 20+ set `sys.base_prefix` as per
            # https://www.python.org/dev/peps/pep-0405/.
            or getattr(sys, "base_prefix", sys.prefix)
        ),
        python_tag=preferred_tag.interpreter,
        abi_tag=preferred_tag.abi,
        platform_tag=preferred_tag.platform,
        version=sys.version_info[:3],
        supported_tags=supported_tags,
        env_markers=markers.default_environment(),
    )