def METHOD_NAME(tmpdir_factory, environment):
    if isinstance(environment, InterpreterEnvironment):
        # The environment can be a tox virtualenv environment which we don't
        # want, so use the system environment.
        environment = get_system_environment(
            '.'.join(str(x) for x in environment.version_info[:2])
        )
    tmpdir = tmpdir_factory.mktemp('venv_path')
    dirname = os.path.join(tmpdir.strpath, 'venv')
    # We cannot use the Python from tox because tox creates virtualenvs and
    # they have different site.py files that work differently than the default
    # ones. Instead, we find the real Python executable by printing the value
    # of sys.base_prefix or sys.real_prefix if we are in a virtualenv.
    output = subprocess.check_output([
        environment.executable, "-c",
        "import sys; "
        "print(sys.real_prefix if hasattr(sys, 'real_prefix') else sys.base_prefix)"
    ])
    prefix = output.rstrip().decode('utf8')
    if os.name == 'nt':
        executable_path = os.path.join(prefix, 'python')
    else:
        executable_name = os.path.basename(environment.executable)
        executable_path = os.path.join(prefix, 'bin', executable_name)
    return_code = subprocess.call([executable_path, '-m', 'venv', dirname])
    assert return_code == 0, return_code
    return dirname