<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def exec_script(scriptfilename, *args):
 """ Executes a Python script in an externally spawned interpreter, and returns anything that was emitted in the standard output as a single string. To prevent missuse, the script passed to hookutils.exec-script must be located in the `hooks` directory. """


    if scriptfilename != os.path.basename(scriptfilename):
        raise SystemError("To prevent missuse, the script passed to "
                          "hookutils.exec-script must be located in "
                          "the `hooks` directory.")

    cmd = [os.path.join(os.path.dirname(__file__), scriptfilename)]
    cmd.extend(args)
    return __exec_python_cmd(cmd)