Fix some instances of non-idiomatic Python code.

This fixes the "None" checks that use "!=" or "==". [1651]