code: def update_docstring_with_examples(cls_doc, ex):
      """Update a commands docstring with examples.
  
      Take _examples_ of a command, build the Python examples, and append
      them to the docstring.
  
      Parameters
      ----------
      cls_doc: str
        docstring
      ex: list
        list of dicts with examples
      """
      from textwrap import indent
  
      if len(cls_doc):
          cls_doc += "\n"
      cls_doc += "    Examples\n    --------\n"
      # loop though provided examples
      for example in ex:
          cls_doc += indent(
              build_example(example, api="python"), " " * 4
          )
  
      return cls_doc
  
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 11 for calling a global function with example usage: update_docstring_with_examples(cls_doc, ex) and returns: cls_doc