Minor code cleanup

This does some minor code cleanup on the SDK. Specifically I:

- Removed trailing whitespace from all files.
- Fixed typos.
- Fixed a number of issues found by `pyflakes` and `pep8.py` ([PEP 8 -- Style Guide for Python Code](http://www.python.org/dev/peps/pep-0008))