Pep8 fixes and fix traling spaces

Fix several pep8 issues and remove trailing spaces. 

I can not find the code guides for the project, so I ended up fixing it because i have my editor configured to automatically remove the trailing spaces. 

I also fixed some pep8 issues. Basically the ones where there is only one blank line and 2 are required.