code: def compact(text, **kw):
      
      return '\n\n'.join(' '.join(p.split()) for p in text.split('\n\n')).format(**kw)
docs: Compact whitespace in a string and format any keyword arguments into the string.
  
      :param text: The text to compact (a string).
      :param kw: Any keyword arguments to apply using :func:`str.format()`.
      :returns: The compacted, formatted string.
  
      The whitespace compaction preserves paragraphs.