The :class:`~textwrap.TextWrapper` class has two new attributes/constructor arguments: :attr:`~textwrap.TextWrapper.max_lines`, which limits the number of lines in the output, and :attr:`~textwrap.TextWrapper.placeholder`, which is a string that will appear at the end of the output if it has been truncated because of *max_lines*.Building on these capabilities, a new convenience function :func:`~textwrap.shorten` collapses all of the whitespace in the input to single spaces and produces a single line of a given *width* that ends with the *placeholder* (by default, ``[...]``).(Contributed by Antoine Pitrou and Serhiy Storchaka in :issue:`18585` and :issue:`18725`.)