def METHOD_NAME(t):
    global pesq_sample_rate_opt
    global input_filename
    global output_filename
    endpt = t.process[0]
    # Execute PESQ
    fullcmd = os.path.normpath(PESQ) + " " + pesq_sample_rate_opt + " " + input_filename + " " + output_filename
    endpt.trace("Popen " + fullcmd)
    pesq_proc = subprocess.Popen(fullcmd, shell=True, stdout=subprocess.PIPE, universal_newlines=True)
    pesq_out  = pesq_proc.communicate()
    # Parse ouput
    mo_pesq_out = re.compile("Prediction[^=]+=\s+([\-\d\.]+)\s*").search(pesq_out[0])
    if (mo_pesq_out == None):
        raise TestError("Failed to fetch PESQ result")
    # Get threshold
    if (cfg_file.pesq_threshold != None) | (cfg_file.pesq_threshold > -0.5 ):
        threshold = cfg_file.pesq_threshold
    else:
        threshold = PESQ_DEFAULT_THRESHOLD
    # Evaluate the PESQ MOS value
    pesq_res = mo_pesq_out.group(1)
    if (float(pesq_res) >= threshold):
        endpt.trace("Success, PESQ result = " + pesq_res + " (target=" + str(threshold) + ").")
    else:
        endpt.trace("Failed, PESQ result = " + pesq_res + " (target=" + str(threshold) + ").")
        # Save the wav file
        wavoutname = ARGS[1]
        wavoutname = re.sub("[\\\/]", "_", wavoutname)
        wavoutname = re.sub("\.py$", ".wav", wavoutname)
        wavoutname = "logs/" + wavoutname
        try:
            shutil.copyfile(output_filename, wavoutname)
            print("Output WAV is copied to " + wavoutname)
        except:
            print("Couldn't copy output WAV, please check if 'logs' directory exists.")
        raise TestError("WAV seems to be degraded badly, PESQ = "+ pesq_res + " (target=" + str(threshold) + ").")