def _specfiledata_getdoc(method):
    s = SpecfileData('DUMMY!')
    head = "\n Docstring from {0}:\n -------------------\n".format(method)
    return head + getattr(getattr(s, method), '__doc__')
to get the docstring of method inside a class
dataset/ETHPy150Open xraypy/xraylarch/plugins/io/specfiledata.py/_specfiledata_getdoc