def doc_unwrap(raw_doc):
if raw_doc is None:<EOL><INDENT>return None<EOL><DEDENT>docstring = '<STR_LIT>'<EOL>consecutive_newlines = <NUM_LIT:0><EOL>for c in raw_doc.strip():<EOL><INDENT>if c == '<STR_LIT:\n>':<EOL><INDENT>consecutive_newlines += <NUM_LIT:1><EOL>if consecutive_newlines > <NUM_LIT:1>:<EOL><INDENT>docstring += c<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if consecutive_newlines == <NUM_LIT:1>:<EOL><INDENT>docstring += '<STR_LIT:U+0020>'<EOL><DEDENT>consecutive_newlines = <NUM_LIT:0><EOL>docstring += c<EOL><DEDENT><DEDENT>return docstring<EOL>
Applies two transformations to raw_doc:
1. N consecutive newlines are converted into N-1 newlines.
2. A lone newline is converted to a space, which basically unwraps text.

Returns a new string, or None if the input was None.