for line in lines:
    line = line.strip()
if line == '' or line.startswith('#') or docstring and not (line.startswith
    ('"""') or line.startswith("'''")) or line.startswith("'''"
    ) and line.endswith("'''") and len(line) > 3 or line.startswith('"""'
    ) and line.endswith('"""') and len(line) > 3:
    pass
How to count lines of code in Python excluding comments and docstrings?