Correct flake8 E302 violations

This corrects around half of the existing flake8 E302 (expected 2 blank lines, found 1) violations.