def stripped_lines(lines, ignore_comments, ignore_docstrings, ignore_imports):
if ignore_imports:<EOL><INDENT>tree = astroid.parse("<STR_LIT>".join(lines))<EOL>node_is_import_by_lineno = (<EOL>(node.lineno, isinstance(node, (astroid.Import, astroid.ImportFrom)))<EOL>for node in tree.body<EOL>)<EOL>line_begins_import = {<EOL>lineno: all(is_import for _, is_import in node_is_import_group)<EOL>for lineno, node_is_import_group in groupby(<EOL>node_is_import_by_lineno, key=lambda x: x[<NUM_LIT:0>]<EOL>)<EOL>}<EOL>current_line_is_import = False<EOL><DEDENT>strippedlines = []<EOL>docstring = None<EOL>for lineno, line in enumerate(lines, start=<NUM_LIT:1>):<EOL><INDENT>line = line.strip()<EOL>if ignore_docstrings:<EOL><INDENT>if not docstring and any(<EOL>line.startswith(i) for i in ['<STR_LIT>', "<STR_LIT>", '<STR_LIT>', "<STR_LIT>"]<EOL>):<EOL><INDENT>docstring = line[:<NUM_LIT:3>]<EOL>line = line[<NUM_LIT:3>:]<EOL><DEDENT>if docstring:<EOL><INDENT>if line.endswith(docstring):<EOL><INDENT>docstring = None<EOL><DEDENT>line = "<STR_LIT>"<EOL><DEDENT><DEDENT>if ignore_imports:<EOL><INDENT>current_line_is_import = line_begins_import.get(<EOL>lineno, current_line_is_import<EOL>)<EOL>if current_line_is_import:<EOL><INDENT>line = "<STR_LIT>"<EOL><DEDENT><DEDENT>if ignore_comments:<EOL><INDENT>line = line.split("<STR_LIT:#>", <NUM_LIT:1>)[<NUM_LIT:0>].strip()<EOL><DEDENT>strippedlines.append(line)<EOL><DEDENT>return strippedlines<EOL>
return lines with leading/trailing whitespace and any ignored code
    features removed