#NEWLINE# def _GetEndTokenAndContents( start_token ) : #NEWLINE# #INDENT# 'Returns last content token and all contents before FLAG_ENDING_TYPE token.\n\n  Comment prefixes are split into DOC_PREFIX tokens and stripped from the\n  returned contents.\n\n  Args:\n    start_token: The token immediately before the first content token.\n\n  Returns:\n    The last content token and a string of all contents including start and\n    end tokens, with comment prefixes stripped.\n  ' #NEWLINE# iterator = start_token #NEWLINE# last_line = iterator . line_number #NEWLINE# last_token = None #NEWLINE# contents = '' #NEWLINE# doc_depth = 0 #NEWLINE# while ( ( not ( iterator . type in Type . FLAG_ENDING_TYPES ) ) or ( doc_depth > 0 ) ) : #NEWLINE# #INDENT# if ( iterator . IsFirstInLine ( ) and DocFlag . EMPTY_COMMENT_LINE . match ( iterator . line ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( ( iterator . type == Type . DOC_START_BRACE ) and ( iterator . next . type == Type . DOC_INLINE_FLAG ) ) : #NEWLINE# #INDENT# doc_depth += 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( iterator . type == Type . DOC_END_BRACE ) and ( doc_depth > 0 ) ) : #NEWLINE# #INDENT# doc_depth -= 1 #NEWLINE# #UNINDENT# #UNINDENT# if ( iterator . type in Type . FLAG_DESCRIPTION_TYPES ) : #NEWLINE# #INDENT# contents += iterator . string #NEWLINE# last_token = iterator #NEWLINE# #UNINDENT# iterator = iterator . next #NEWLINE# if ( iterator . line_number != last_line ) : #NEWLINE# #INDENT# contents += '\n' #NEWLINE# last_line = iterator . line_number #NEWLINE# #UNINDENT# #UNINDENT# end_token = last_token #NEWLINE# if DocFlag . EMPTY_STRING . match ( contents ) : #NEWLINE# #INDENT# contents = None #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# contents = contents [ : ( - 1 ) ] #NEWLINE# #UNINDENT# return ( end_token , contents )