code: def shellcode(
      executables,
      use_defaults=True,
      shell="bash",
      complete_arguments=None,
      argcomplete_script=None,
  ):
      """
      Provide the shell code required to register a python executable for use with the argcomplete module.
  
      :param list(str) executables: Executables to be completed (when invoked exactly with this name)
      :param bool use_defaults: Whether to fallback to readline's default completion when no matches are generated
          (affects bash only)
      :param str shell: Name of the shell to output code for
      :param complete_arguments: Arguments to call complete with (affects bash only)
      :type complete_arguments: list(str) or None
      :param argcomplete_script: Script to call complete with, if not the executable to complete.
          If supplied, will be used to complete *all* passed executables.
      :type argcomplete_script: str or None
      """
  
      if complete_arguments is None:
          complete_options = (
              "-o nospace -o default -o bashdefault"
              if use_defaults
              else "-o nospace -o bashdefault"
          )
      else:
          complete_options = " ".join(complete_arguments)
  
      if shell == "bash" or shell == "zsh":
          quoted_executables = [quote(i) for i in executables]
          executables_list = " ".join(quoted_executables)
          script = argcomplete_script
          if script:
              function_suffix = "_" + script
          else:
              script = ""
              function_suffix = ""
          code = bashcode % dict(
              complete_opts=complete_options,
              executables=executables_list,
              argcomplete_script=script,
              function_suffix=function_suffix,
          )
      elif shell == "fish":
          code = ""
          for executable in executables:
              script = argcomplete_script or executable
              completion_arg = (
                  "--path" if "/" in executable else "--command"
              )  # use path for absolute paths
              function_name = executable.replace(
                  "/", "_"
              )  # / not allowed in function name
  
              code += fishcode % dict(
                  executable=executable,
                  argcomplete_script=script,
                  completion_arg=completion_arg,
                  function_name=function_name,
              )
      elif shell == "powershell":
          code = ""
          for executable in executables:
              script = argcomplete_script or executable
              code += powershell_code % dict(
                  executable=executable, argcomplete_script=script
              )
  
      else:
          code = ""
          for executable in executables:
              script = argcomplete_script
              # If no script was specified, default to the executable being completed.
              if not script:
                  script = executable
              code += shell_codes.get(shell, "") % dict(
                  executable=executable, argcomplete_script=script
              )
  
      return code
  
label_desc: Use image node_id 1 for calling a global function with example usage: shellcode(executables, use_defaults, shell, complete_arguments, argcomplete_script) and returns: code