code: def find_method_docstring(klass, method: str) -> str:
      """Look through a class' ancestors for the first non-empty method docstring.
  
      Since Python 3.5, inspect.getdoc is supposed to do exactly this. However, it doesn't seem to
      work for Cython classes.
  
      Examples
      --------
  
      >>> class Parent:
      ...
      ...     def foo(self):
      ...         '''foo method'''
  
      >>> class Child(Parent):
      ...
      ...     def foo(self):
      ...         ...
  
      >>> find_method_docstring(Child, 'foo')
      'foo method'
  
      """
  
      for ancestor in inspect.getmro(klass):
          try:
              ancestor_meth = getattr(ancestor, method)
          except AttributeError:
              break
          if doc := inspect.getdoc(ancestor_meth):
              return doc
  
imports: import argparse
  import collections
  import doctest
  import functools
  import importlib
  import inspect
  import os
  import pathlib
  import re
  import shutil
  from numpydoc.docscrape import ClassDoc, FunctionDoc
label_desc: Use image node_id 10 for calling a global function with example usage: find_method_docstring(klass, method) and returns: doc