code: def get_cmd_summaries(descriptions, groups, width=79):
      """Return summaries for the commands in `groups`.
  
      Parameters
      ----------
      descriptions : dict
          A map of group names to summaries.
      groups : list of tuples
          A list of groups and commands in the form described by
          `get_interface_groups`.
      width : int, optional
          The maximum width of each line in the summary text.
  
      Returns
      -------
      A list with a formatted entry for each command. The first command of each
      group is preceded by an entry describing the group.
      """
      cmd_summary = []
      for grp in sorted(groups, key=lambda x: x[0]):
          grp_descr = grp[1]
          grp_cmds = descriptions[grp[0]]
  
          cmd_summary.append("\n*%s*\n" % (grp_descr,))
          for cd in grp_cmds:
              cmd_summary.append(
                  "  %s\n%s"
                  % (
                      (
                          cd[0],
                          textwrap.fill(
                              cd[1].rstrip(" ."),
                              width - 5,
                              initial_indent=" " * 6,
                              subsequent_indent=" " * 6,
                          ),
                      )
                  )
              )
      return cmd_summary
  
imports: import inspect
  import logging
  import os
  import re
  import textwrap
  import warnings
  from abc import ABC, abstractmethod
  from functools import wraps
  from importlib import import_module
  from typing import Callable, Dict, Generator, TypeVar, TYPE_CHECKING
  import datalad
  from datalad import cfg
  from datalad.core.local.resulthooks import get_jsonhooks_from_config, match_jsonhook2result, run_jsonhook
  from datalad.distribution.dataset import Dataset, resolve_path
  from datalad.interface.common_opts import eval_params
  from datalad.interface.results import known_result_xfms
  from datalad.interface.utils import get_result_filter, keep_result, render_action_summary, xfm_result, _process_results
  from datalad.support.exceptions import CapturedException, IncompleteResultsError
  from datalad.utils import get_wrapped_class
label_desc: Use image node_id 3 for calling a global function with example usage: get_cmd_summaries(descriptions, groups, width) and returns: cmd_summary