def METHOD_NAME(text, file, predefined, variables, remote, output, ephemeral_instance, **kwargs):
    query = None
    if text is not None and file is None and predefined is None:
        query = text.strip("'\" \n\t")
    elif file is not None and text is None and predefined is None:
        query = file.read()
    elif predefined is not None and text is None and file is None:
        query = PREDEFINED_QUERIES[predefined]
    else:
        raise click.UsageError(
            "Must select one and only one of text (-t), file (-f), or predefined (-p) "
            "to select GraphQL document to execute."
        )
    if remote:
        res = execute_query_against_remote(remote, query, variables)
        print(res)  # noqa: T201
    else:
        with (
            get_temporary_instance_for_cli() if ephemeral_instance else get_instance_for_cli()
        ) as instance:
            with get_workspace_process_context_from_kwargs(
                instance, version=__version__, read_only=False, kwargs=kwargs
            ) as workspace_process_context:
                execute_query_from_cli(
                    workspace_process_context,
                    query,
                    variables,
                    output,
                )