PEP-8 compliance.
Mostly formatting and some has_key() to 'in' changes.