#NEWLINE# def get_docstring( node , clean = True ) : #NEWLINE# #INDENT# '\n    Return the docstring for the given node or None if no docstring can\n    be found.  If the node provided does not have docstrings a TypeError\n    will be raised.\n    ' #NEWLINE# if ( not isinstance ( node , ( FunctionDef , ClassDef , Module ) ) ) : #NEWLINE# #INDENT# raise TypeError ( ( "%r can't have docstrings" % node . __class__ . __name__ ) ) #NEWLINE# #UNINDENT# if ( node . body and isinstance ( node . body [ 0 ] , Expr ) and isinstance ( node . body [ 0 ] . value , Str ) ) : #NEWLINE# #INDENT# if clean : #NEWLINE# #INDENT# import inspect #NEWLINE# return inspect . cleandoc ( node . body [ 0 ] . value . s ) #NEWLINE# #UNINDENT# return node . body [ 0 ] . value . s