code: def _bounded(p1, p2, line, pos, line_no, lines):
      
      substrings = []
      start_line_no = line_no
      end = pos
      while not line.startswith(p2, end):
          if line[end] == '\\':
              end += 2
          else:
              end += 1
          if end >= len(line):
              substrings.append(line[pos:])
              try:
                  line_no, line = next(lines)
              except StopIteration:
                  pattern = 'docstring' if p1 == '"""' else 'block comment'
                  raise TdlParsingError('Unterminated {}'.format(pattern),
                                        line_number=start_line_no)
              pos = end = 0
      substrings.append(line[pos:end])
      end += len(p2)
      return ''.join(substrings), start_line_no, line_no, line, end
docs: Collect the contents of a bounded multiline string