code: def fail_with_short_help(
      parser=None,
      msg=None,
      known=None,
      provided=None,
      hint=None,
      exit_code=1,
      what="command",
      out=None,
  ):
      """Generic helper to fail
      with short help possibly hinting on what was intended if `known`
      were provided
      """
      out = out or sys.stderr
      if msg:
          out.write("error: %s\n" % msg)
      if not known:
          if parser:
              parser_add_common_opt(parser, "help")
              # just to appear in print_usage also consistent with --help output
              parser.add_argument("command [command-opts]")
              parser.print_usage(file=out)
      else:
          out.write(
              "datalad: Unknown %s %r.  See 'datalad --help'.\n\n"
              % (
                  what,
                  provided,
              )
          )
          if provided not in known:
              from datalad.utils import get_suggestions_msg
  
              out.write(get_suggestions_msg(provided, known))
      if hint:
          out.write("Hint: %s\n" % hint)
      raise SystemExit(exit_code)
  
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 12 for calling a global function with example usage: fail_with_short_help(parser, msg, known, provided, hint, exit_code, what, out) without return types