<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wrap_cc(filepath, compiler, project, python=sys.executable, detect_project=False):
 """ Substitute a compiler with a script that hides CFLAGS & LDFLAGS. This will generate a wrapper script in the current directory and return a complete plumbum command to it. Args: filepath (str):
 Path to the wrapper script. compiler (benchbuild.utils.cmd):
 Real compiler command we should call in the script. project (benchbuild.project.Project):
 The project this compiler will be for. python (str):
 Path to the python interpreter we should use. detect_project: Should we enable project detection or not. Returns (benchbuild.utils.cmd):
 Command of the new compiler we can call. """

    env = __create_jinja_env()
    template = env.get_template('run_compiler.py.inc')

    cc_fname = local.path(filepath).with_suffix(".benchbuild.cc", depth=0)
    cc_f = persist(compiler, filename=cc_fname)

    project_file = persist(project, suffix=".project")

    with open(filepath, 'w') as wrapper:
        wrapper.write(
            template.render(
                cc_f=cc_f,
                project_file=project_file,
                python=python,
                detect_project=detect_project))

    chmod("+x", filepath)
    LOG.debug("Placed wrapper in: %s for compiler %s", local.path(filepath),
              str(compiler))
    LOG.debug("Placed project in: %s", local.path(project_file))
    LOG.debug("Placed compiler command in: %s", local.path(cc_f))
    return local[filepath]