code: def _summarize_doc(doc, length=60):
      r
      import re
      if doc is None:
          return ""
      assert length > 3, "length <= 3 is absurdly short for a doc summary"
      doclines = doc.strip().splitlines(0)
      if not doclines:
          return ""
  
      summlines = []
      for i, line in enumerate(doclines):
          stripped = line.strip()
          if not stripped:
              break
          summlines.append(stripped)
          if len(''.join(summlines)) >= length:
              break
  
      summary = ' '.join(summlines)
      if len(summary) > length:
          summary = summary[:length - 3] + "..."
      return summary
docs: r"""Parse out a short one line summary from the given doclines.
  
          "doc" is the doc string to summarize.
          "length" is the max length for the summary
  
      >>> _summarize_doc("this function does this")
      'this function does this'
      >>> _summarize_doc("this function does this", 10)
      'this fu...'
      >>> _summarize_doc("this function does this\nand that")
      'this function does this and that'
      >>> _summarize_doc("this function does this\n\nand that")
      'this function does this'