code: def reverse_aliases(app: Application) -> dict[str, list[str]]:
      """Produce a mapping of trait names to lists of command line aliases."""
      res = defaultdict(list)
      for alias, trait in app.aliases.items():
          res[trait].append(alias)
  
      # Flags also often act as aliases for a boolean trait.
      # Treat flags which set one trait to True as aliases.
      for flag, (cfg, _) in app.flags.items():
          if len(cfg) == 1:
              classname = next(iter(cfg))
              cls_cfg = cfg[classname]
              if len(cls_cfg) == 1:
                  traitname = next(iter(cls_cfg))
                  if cls_cfg[traitname] is True:
                      res[classname + "." + traitname].append(flag)
  
      return res
  
file_path: catboost/contrib/python/traitlets/py3/traitlets/config/sphinxdoc.py
imports: from __future__ import annotations
  import typing
  from collections import defaultdict
  from textwrap import dedent
  from traitlets import HasTraits, Undefined
  from traitlets.config.application import Application
  from traitlets.utils.text import indent
label_desc: Use image node_id 5 for calling a global function with example usage: reverse_aliases(app) and returns: res