code: def generate_documentation():
      documentation = {}
      for mode, class_list in classes_to_document.items():
          documentation[mode] = []
          for cls, fns in class_list:
              fn_to_document = (
                  cls if inspect.isfunction(cls) else cls.__init__
              )
              _, parameter_doc, return_doc, _ = document_fn(
                  fn_to_document, cls
              )
              cls_description, cls_tags, cls_example = document_cls(cls)
              cls_documentation = {
                  "class": cls,
                  "name": cls.__name__,
                  "description": cls_description,
                  "tags": cls_tags,
                  "parameters": parameter_doc,
                  "returns": return_doc,
                  "example": cls_example,
                  "fns": [],
              }
              for fn_name in fns:
                  instance_attribute_fn = fn_name.startswith("*")
                  if instance_attribute_fn:
                      fn_name = fn_name[1:]
                      # Instance attribute fns are classes
                      # whose __call__ method determines their behavior
                      fn = getattr(cls(), fn_name).__call__
                  else:
                      fn = getattr(cls, fn_name)
                  if not callable(fn):
                      description_doc = str(fn)
                      parameter_docs = {}
                      return_docs = {}
                      examples_doc = ""
                      override_signature = (
                          f"gr.{cls.__name__}.{fn_name}"
                      )
                  else:
                      (
                          description_doc,
                          parameter_docs,
                          return_docs,
                          examples_doc,
                      ) = document_fn(fn, cls)
                      if fn_name in getattr(cls, "EVENTS", []):
                          parameter_docs = parameter_docs[1:]
                      override_signature = None
                  if instance_attribute_fn:
                      description_doc = extract_instance_attr_doc(
                          cls, fn_name
                      )
                  cls_documentation["fns"].append(
                      {
                          "fn": fn,
                          "name": fn_name,
                          "description": description_doc,
                          "tags": {},
                          "parameters": parameter_docs,
                          "returns": return_docs,
                          "example": examples_doc,
                          "override_signature": override_signature,
                      }
                  )
              documentation[mode].append(cls_documentation)
              if cls in classes_inherit_documentation:
                  classes_inherit_documentation[
                      cls
                  ] = cls_documentation["fns"]
      for mode, class_list in classes_to_document.items():
          for i, (cls, _) in enumerate(class_list):
              for super_class in classes_inherit_documentation:
                  if (
                      inspect.isclass(cls)
                      and issubclass(cls, super_class)
                      and cls != super_class
                  ):
                      for inherited_fn in classes_inherit_documentation[
                          super_class
                      ]:
                          inherited_fn = dict(inherited_fn)
                          try:
                              inherited_fn[
                                  "description"
                              ] = extract_instance_attr_doc(
                                  cls, inherited_fn["name"]
                              )
                          except (ValueError, AssertionError):
                              pass
                          documentation[mode][i]["fns"].append(
                              inherited_fn
                          )
      return documentation
  
file_path: gradio/client/python/gradio_client/documentation.py
imports: from __future__ import annotations
  import inspect
  from typing import Callable
label_desc: Use image node_id 6 for calling a global function with example usage: generate_documentation() and returns: documentation