def load_pyproject_toml(<EOL>use_pep517,  <EOL>pyproject_toml,  <EOL>setup_py,  <EOL>req_name  <EOL>):<EOL>
has_pyproject = os.path.isfile(pyproject_toml)<EOL>has_setup = os.path.isfile(setup_py)<EOL>if has_pyproject:<EOL><INDENT>with io.open(pyproject_toml, encoding="<STR_LIT:utf-8>") as f:<EOL><INDENT>pp_toml = pytoml.load(f)<EOL><DEDENT>build_system = pp_toml.get("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>build_system = None<EOL><DEDENT>if has_pyproject and not has_setup:<EOL><INDENT>if use_pep517 is not None and not use_pep517:<EOL><INDENT>raise InstallationError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>use_pep517 = True<EOL><DEDENT>elif build_system and "<STR_LIT>" in build_system:<EOL><INDENT>if use_pep517 is not None and not use_pep517:<EOL><INDENT>raise InstallationError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>build_system["<STR_LIT>"]<EOL>)<EOL>)<EOL><DEDENT>use_pep517 = True<EOL><DEDENT>elif use_pep517 is None:<EOL><INDENT>use_pep517 = has_pyproject<EOL><DEDENT>assert use_pep517 is not None<EOL>if not use_pep517:<EOL><INDENT>return None<EOL><DEDENT>if build_system is None:<EOL><INDENT>build_system = {<EOL>"<STR_LIT>": ["<STR_LIT>", "<STR_LIT>"],<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>}<EOL><DEDENT>assert build_system is not None<EOL>error_template = (<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL>if "<STR_LIT>" not in build_system:<EOL><INDENT>raise InstallationError(<EOL>error_template.format(package=req_name, reason=(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>))<EOL>)<EOL><DEDENT>requires = build_system["<STR_LIT>"]<EOL>if not _is_list_of_str(requires):<EOL><INDENT>raise InstallationError(error_template.format(<EOL>package=req_name,<EOL>reason="<STR_LIT>",<EOL>))<EOL><DEDENT>backend = build_system.get("<STR_LIT>")<EOL>check = []  <EOL>if backend is None:<EOL><INDENT>backend = "<STR_LIT>"<EOL>check = ["<STR_LIT>", "<STR_LIT>"]<EOL><DEDENT>return (requires, backend, check)<EOL>
Load the pyproject.toml file.

    Parameters:
        use_pep517 - Has the user requested PEP 517 processing? None
                     means the user hasn't explicitly specified.
        pyproject_toml - Location of the project's pyproject.toml file
        setup_py - Location of the project's setup.py file
        req_name - The name of the requirement we're processing (for
                   error reporting)

    Returns:
        None if we should use the legacy code path, otherwise a tuple
        (
            requirements from pyproject.toml,
            name of PEP 517 backend,
            requirements we should check are installed after setting
                up the build environment
        )