code: def document_geom(geom: type[Geom]) -> type[Geom]:
      """
      Create a structured documentation for the geom
  
      It replaces `{usage}`, `{common_parameters}` and
      `{aesthetics}` with generated documentation.
      """
      docstring = dedent(geom.__doc__ or "")
      docstring = append_to_section(
          geom_kwargs, docstring, "Parameters"
      )
  
      # usage
      signature = make_signature(
          geom.__name__,
          geom.DEFAULT_PARAMS,
          common_geom_params,
          common_geom_param_values,
      )
      usage = GEOM_SIGNATURE_TPL.format(signature=signature)
  
      # aesthetics
      contents = {f"**{ae}**": "" for ae in sorted(geom.REQUIRED_AES)}
      if geom.DEFAULT_AES:
          d = geom.DEFAULT_AES.copy()
          d["group"] = ""  # All geoms understand the group aesthetic
          contents.update(sorted(d.items()))
  
      table = dict_to_table(("Aesthetic", "Default value"), contents)
      aesthetics_table = AESTHETICS_TABLE_TPL.format(table=table)
      tpl = dedent(geom._aesthetics_doc).strip()
      aesthetics_doc = tpl.format(aesthetics_table=aesthetics_table)
      aesthetics_doc = indent(aesthetics_doc, " " * 4)
  
      # common_parameters
      d = geom.DEFAULT_PARAMS
      common_parameters = GEOM_PARAMS_TPL.format(
          default_stat=default_class_name(d["stat"]),
          default_position=default_class_name(d["position"]),
          default_na_rm=d["na_rm"],
          default_inherit_aes=d.get("inherit_aes", True),
          default_raster=d.get("raster", False),
          _aesthetics_doc=aesthetics_doc,
          **common_params_doc,
      ).strip()
  
      docstring = docstring.replace("{usage}", usage)
      docstring = docstring.replace(
          "{common_parameters}", common_parameters
      )
      geom.__doc__ = docstring
      return geom
  
file_path: plotnine/plotnine/doctools.py
imports: from __future__ import annotations
  import itertools
  import os
  import re
  import typing
  from functools import lru_cache
  from textwrap import dedent, indent
label_desc: Use image node_id 10 for calling a global function with example usage: document_geom(geom) and returns: geom