python 3 compatibility and whitespce cleanup. fixes #30