def _GetEndTokenAndContents(start_token):
  iterator = start_token
  last_line = iterator.line_number
  last_token = None
  contents = ''
  doc_depth = 0
  while not iterator.type in Type.FLAG_ENDING_TYPES or doc_depth > 0:
    if (iterator.IsFirstInLine() and
        DocFlag.EMPTY_COMMENT_LINE.match(iterator.line)):
      # If we have a blank comment line, consider that an implicit
      # ending of the description. This handles a case like:
      #
      # * @return {boolean} True
      # *
      # * Note: This is a sentence.
      #
      # The note is not part of the @return description, but there was
      # no definitive ending token. Rather there was a line containing
      # only a doc comment prefix or whitespace.
      break

    # b/2983692
    # don't prematurely match against a @flag if inside a doc flag
    # need to think about what is the correct behavior for unterminated
    # inline doc flags
    if (iterator.type == Type.DOC_START_BRACE and
        iterator.next.type == Type.DOC_INLINE_FLAG):
      doc_depth += 1
    elif (iterator.type == Type.DOC_END_BRACE and
        doc_depth > 0):
      doc_depth -= 1

    if iterator.type in Type.FLAG_DESCRIPTION_TYPES:
      contents += iterator.string
      last_token = iterator

    iterator = iterator.next
    if iterator.line_number != last_line:
      contents += '\n'
      last_line = iterator.line_number

  end_token = last_token
  if DocFlag.EMPTY_STRING.match(contents):
    contents = None
  else:
    # Strip trailing newline.
    contents = contents[:-1]

  return end_token, contents
Processes a view's return value and ensures it's a response
dataset/ETHPy150Open google/closure-linter/closure_linter/statetracker.py/_GetEndTokenAndContents--crossover with--dataset/ETHPy150Open mitsuhiko/solace/solace/application.py/Request.process_view_result