Normalize whitespace
Resave with excess whitespace removed
Add docstrings and extract a variable for clarity of implementation.