Removed unnecessary semicolons.
Used "is" for comparisons with None.
Fixed "redefinition of unused 'foo' from line X" pyflakes warnings.
Fixed an undefined variable and clarified the purpose of a test.

refs #4459.
Whitespace cleanup.

* Removed trailing whitespace.
* Added newline to EOF if missing.
* Removed blank lines at EOF.
* Removed some stray tabs.
Sanitized test assertions in gdal tests