fixes #284 - replace deprecated has_key method
fixed a bunch of pep8 warnings
fixed a bunch more of pep8 warnings
and even more pep8 warning fixes