code: def setup_parser_for_interface(parser, cls, completing=False):
      # XXX needs safety check for name collisions
      # XXX allow for parser kwargs customization
      # get the signature, order of arguments is taken from it
      ndefaults = 0
      args, varargs, varkw, defaults = getargspec(
          cls.__call__, include_kwonlyargs=True
      )
      if defaults is not None:
          ndefaults = len(defaults)
      default_offset = ndefaults - len(args)
      prefix_chars = parser.prefix_chars
      for i, arg in enumerate(args):
          if not is_api_arg(arg):
              continue
  
          param = cls._params_[arg]
          defaults_idx = default_offset + i
          if param.cmd_args == tuple():
              # explicitly provided an empty sequence of argument names
              # this shall not appear in the parser
              continue
  
          # set up the parameter
          setup_parserarg_for_interface(
              parser,
              arg,
              param,
              defaults_idx,
              prefix_chars,
              defaults,
              completing=completing,
          )
  
imports: import argparse
  import logging
  import sys
  from collections import defaultdict
  from functools import partial
  from datalad import __version__
  from datalad.interface.base import get_cmd_doc, get_interface_groups, is_api_arg, load_interface
  from datalad.support.constraints import EnsureChoice
  from datalad.utils import getargspec
  from .common_args import common_args
  from .exec import call_from_parser
  from .helpers import get_commands_from_groups
  from .interface import alter_interface_docs_for_cmdline, get_cmd_ex, get_cmdline_command_name
label_desc: Use image node_id 2 for calling a global function with example usage: setup_parser_for_interface(parser, cls, completing) without return types