code: def get_doc_object(obj, what=None, config=None):
      if what is None:
          if inspect.isclass(obj):
              what = "class"
          elif inspect.ismodule(obj):
              what = "module"
          elif isinstance(obj, collections.Callable):
              what = "function"
          else:
              what = "object"
      if what == "class":
          doc = SphinxTraitsDoc(
              obj, "", func_doc=SphinxFunctionDoc, config=config
          )
          if looks_like_issubclass(obj, "HasTraits"):
              for (
                  name,
                  trait,
                  comment,
              ) in comment_eater.get_class_traits(obj):
                  # Exclude private traits.
                  if not name.startswith("_"):
                      doc["Traits"].append(
                          (name, trait, comment.splitlines())
                      )
          return doc
      elif what in ("function", "method"):
          return SphinxFunctionDoc(obj, "", config=config)
      else:
          return SphinxDocString(pydoc.getdoc(obj), config=config)
  
file_path: medpy/doc/numpydoc/numpydoc/traitsdoc.py
imports: import inspect
  import os
  import pydoc
  import collections
  from .None import docscrape
  from .None import docscrape_sphinx
  from .docscrape_sphinx import SphinxClassDoc, SphinxFunctionDoc, SphinxDocString
  from .None import numpydoc
  from .None import comment_eater
label_desc: Use image node_id 2 for calling a global function with example usage: get_doc_object(obj, what, config) and returns: doc, SphinxFunctionDoc, SphinxDocString