Simplification

x == True is redundant.
Less lines, same stuff

Improved dictionary creation.
Do not use equality with None. (Use identity).
Unused variable
Typo and extra whitespace
Semicolons in Python?