def _get_docstring()

in src/kernels/doc.py [0:0]


def _get_docstring(obj, use_dict_check: bool = False) -> str:
    """Get docstring from an object, with fallback to default message."""
    # Check whether the class/method itself has docs and not just
    # the superclass.
    if use_dict_check:
        has_doc = obj.__dict__.get("__doc__", None) is not None
    else:
        has_doc = getattr(obj, "__doc__", None) is not None

    # We use inspect.getdoc because it does normalization.
    doc = inspect.getdoc(obj)

    return doc if has_doc and doc is not None else "No documentation available."