fix errors and warnings related to blank lines

* E301 expected 1 blank line, found 0
* E302 expected 2 blank lines, found 1
* E303 too many blank lines
* W293 blank line contains whitespace
* W391 blank line at end of file