Fix syntax-related PEP8 issues

This changeset resolves 8 PEP8 issues: It addresses the following
syntax-related PEP8 violations:
- E401 multiple imports on one line
- E502 the backslash is redundant between brackets
- W601 .has_key() is deprecated, use 'in'
- E711 comparison to None should be 'if cond is None:'
- E712 comparison to True should be 'if cond is True:' or 'if cond:'

I'll lower the violation threshold after #5925 is merged.