Use identity comparison operators (is, is not) for comparison to None

According to PEP8: "Comparisons to singletons like None should always be
done with is or is not, never the equality operators."

http://www.python.org/dev/peps/pep-0008/#programming-recommendations
PEP8: "Don't compare boolean values to True or False using ==."

In python booleans are singletons. Therefore to check whether an
variable holds a True/False boolean one needs the identity comparison
operators (is/is not). To check whether a variable evaluates to True/
False one should not use a comparison operator at all.