code: def _is_incomplete_option_api_for_args(args):
      """Returns state for args passed to _is_incomplete_option.
  
      Use to support two API versions.
  
      Returns tuple of `all_args`, `arg_str`, and a function that tests
      for start of option for a given arg string.
      """
      if len(args) == 2:
          # Legacy API
          all_args, cmd_param = args
          return (
              all_args,
              cmd_param,
              shell_completion._start_of_option,
          )
      if len(args) == 3:
          ctx, all_args, cmd_param = args
          return (
              all_args,
              cmd_param,
              lambda arg_str: shell_completion._start_of_option(
                  ctx, arg_str
              ),
          )
      # arg count should have been checked in
      # _patch_is_incomplete_option above
      assert False, args
  
imports: import contextlib
  import functools
  import json
  import os
  import re
  import click
  from click import shell_completion
  import guild
  from guild import python_util
label_desc: Use image node_id 18 for calling a global function with example usage: _is_incomplete_option_api_for_args(args) and returns: all_args,  cmd_param,  shell_completion, all_args,  cmd_param,  function