def _to_docstring(doc):
def format_fn(line, status):<EOL><INDENT>"""<STR_LIT>"""<EOL>line = re_to_tag.sub(r"<STR_LIT>", line)<EOL>if re_to_data.match(line):<EOL><INDENT>line = re_to_data.sub(r"<STR_LIT>", line)<EOL>status["<STR_LIT>"] = True<EOL><DEDENT>line = re_to_defaults.sub(r"<STR_LIT>", line)<EOL>if status["<STR_LIT>"]:<EOL><INDENT>if re_to_param.match(line):<EOL><INDENT>line = re_to_param.sub(r"<STR_LIT>", line)<EOL><DEDENT>elif re_to_status.match(line):<EOL><INDENT>line = re_to_status.sub(r"<STR_LIT>", line)<EOL><DEDENT>elif re_to_item.match(line):<EOL><INDENT>line = re_to_item.sub(r"<STR_LIT>", line)<EOL><DEDENT>else:<EOL><INDENT>line = "<STR_LIT:U+0020>" * <NUM_LIT:8> + line.lstrip()<EOL><DEDENT><DEDENT>return line<EOL><DEDENT>return _reformat_docstring(doc, format_fn)<EOL>
format from Markdown to docstring