class_docstr: Automatic detection and parsing of API docs to Sphinx-parsable reST
  format.
code: def write_modules_api(self, modules, outdir):
      # upper-level modules
      ulms = [
          ".".join(m.split(".")[:2])
          if m.count(".") >= 1
          else m.split(".")[0]
          for m in modules
      ]
  
      from collections import OrderedDict
  
      module_by_ulm = OrderedDict()
  
      for v, k in zip(modules, ulms):
          if k in module_by_ulm:
              module_by_ulm[k].append(v)
          else:
              module_by_ulm[k] = [v]
  
      written_modules = []
  
      for ulm, mods in module_by_ulm.items():
          print("Generating docs for %s:" % ulm)
          document_head = []
          document_body = []
  
          for m in mods:
              print("  -> " + m)
              head, body = self.generate_api_doc(m)
  
              document_head.append(head)
              document_body.append(body)
  
          out_module = ulm + self.rst_extension
          outfile = os.path.join(outdir, out_module)
          fileobj = open(outfile, "wt")
  
          fileobj.writelines(document_head + document_body)
          fileobj.close()
          written_modules.append(out_module)
  
      self.written_modules = written_modules
  
imports: import ast
  import os
  import re
  from importlib import import_module
  from types import BuiltinFunctionType, FunctionType
  from inspect import ismethod, getmodule
label_desc: Use image node_id 14 for calling the ApiDocWriter obj's underlying member method code with example usage: obj.write_modules_api(modules, outdir) without return types