docs: def _endCodeIfNeeded(line, inCodeBlock):
          """Simple routine to append end code marker if needed."""
          assert isinstance(line, str)
          if inCodeBlock:
              line = '# @endcode{0}{1}'.format(linesep, line.rstrip())
              inCodeBlock = False
          return line, inCodeBlock