def METHOD_NAME(workspace_process_context, query, variables=None, output=None):
    check.inst_param(
        workspace_process_context, "workspace_process_context", WorkspaceProcessContext
    )
    check.str_param(query, "query")
    check.opt_str_param(variables, "variables")
    check.opt_str_param(output, "output")
    query = query.strip("'\" \n\t")
    result_dict = execute_query(
        workspace_process_context,
        query,
        variables=seven.json.loads(variables) if variables else None,
    )
    str_res = seven.json.dumps(result_dict)
    # Since this the entry point for CLI execution, some tests depend on us putting the result on
    # stdout
    if output:
        check.str_param(output, "output")
        with open(output, "w", encoding="utf8") as f:
            f.write(str_res + "\n")
    else:
        print(str_res)  # noqa: T201
    return str_res