def METHOD_NAME(name):
    cursor = dbcursor_query("SELECT EXISTS (SELECT * FROM test"
                            "  WHERE available AND name = %s)",
                            [ name ])
    exists = cursor.fetchone()[0]
    cursor.close()
    if not exists:
        return not_found()
    try:
        args = arg_json('args')
    except ValueError as ex:
        return bad_request("JSON passed to 'args': %s " % (str(ex)))
    status, stdout, stderr = pscheduler.plugin_invoke(
        'test', name, 'cli-to-spec',
        stdin=pscheduler.json_dump(args),
        timeout=5
        )
    if status != 0:
        return bad_request(stderr)
    # The extra parse here makes 'pretty' work.
    returned_json = pscheduler.json_load(stdout)
    return ok_json(returned_json, sanitize=False)