def shorten(line): indent = re.match(r"^\s*", line).group() return indent + textwrap.shorten(line, 60)