code: def _get_long_help(self, parser):
      helpstr = parser.format_help()
      if " " in parser.prog:  # subcommand
          # in case of a subcommand there is no need to pull the
          # list of top-level subcommands
          return helpstr
      helpstr = re.sub(
          r"^[uU]sage: .*?\n\s*\n",
          "Usage: datalad [global-opts] command [command-opts]\n\n",
          helpstr,
          flags=re.MULTILINE | re.DOTALL,
      )
      # split into preamble and options
      preamble = []
      options = []
      in_options = False
      for line in helpstr.splitlines():
          if line in ("options:", "optional arguments:"):
              in_options = True
              continue
          (options if in_options else preamble).append(line)
  
      intf = self._get_all_interfaces()
      from datalad.interface.base import (
          get_cmd_doc,
          load_interface,
      )
      from .interface import (
          get_cmdline_command_name,
          alter_interface_docs_for_cmdline,
      )
  
      preamble = get_description_with_cmd_summary(
          # produce a mapping of command groups to
          # [(cmdname, description), ...]
          {
              i[0]: [
                  (
                      get_cmdline_command_name(c),
                      # alter_interface_docs_for_cmdline is only needed, because
                      # some commands use sphinx markup in their summary line
                      # stripping that takes 10-30ms for a typical datalad
                      # installation with some extensions
                      alter_interface_docs_for_cmdline(
                          # we only take the first line
                          get_cmd_doc(
                              # we must import the interface class
                              # this will engage @build_doc -- unavoidable right
                              # now
                              load_interface(c)
                          ).split("\n", maxsplit=1)[0]
                      ),
                  )
                  for c in i[2]
              ]
              for i in intf
          },
          intf,
          "\n".join(preamble),
      )
      return "{}\n\n*Global options*\n{}\n".format(
          preamble,
          "\n".join(options),
      )
  
imports: import argparse
  import os
  import re
  import sys
  import gzip
  import textwrap
  from textwrap import wrap
  from datalad import __version__
  from datalad.support.exceptions import CapturedException
  from datalad.ui.utils import get_console_width
  from datalad.utils import is_interactive
  from platformdirs import AppDirs
  from logging import getLogger
label_desc: Use image node_id 2 for calling the HelpAction obj's underlying member method code with example usage: obj._get_long_help(parser) and returns: str, helpstr