def _GetMatchingEndBraceAndContents(start_brace):
  open_count = 1
  close_count = 0
  contents = []

  # We don't consider the start brace part of the type string.
  token = start_brace.next
  while open_count != close_count:
    if token.type == Type.DOC_START_BRACE:
      open_count += 1
    elif token.type == Type.DOC_END_BRACE:
      close_count += 1

    if token.type != Type.DOC_PREFIX:
      contents.append(token.string)

    if token.type in Type.FLAG_ENDING_TYPES:
      break
    token = token.next

  #Don't include the end token (end brace, end doc comment, etc.) in type.
  token = token.previous
  contents = contents[:-1]

  return token, ''.join(contents)
Returns the matching end brace and contents between the two braces.
dataset/ETHPy150Open google/closure-linter/closure_linter/statetracker.py/_GetMatchingEndBraceAndContents