def _appendToDocstring(thingWithDoc, textToAppend):
    if thingWithDoc.__doc__:
        docstringLines = thingWithDoc.__doc__.splitlines()
    else:
        docstringLines = []

    if len(docstringLines) == 0:
        docstringLines.append(textToAppend)
    elif len(docstringLines) == 1:
        docstringLines.extend(['', textToAppend, ''])
    else:
        spaces = docstringLines.pop()
        docstringLines.extend(['',
                               spaces + textToAppend,
                               spaces])
    thingWithDoc.__doc__ = '\n'.join(docstringLines)
Append the given text to the docstring of C{thingWithDoc}.
dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/python/deprecate.py/_appendToDocstring