Do not use equality when comparing with None

Using `!=` works when comparing to `None`, but it isn't correct. This
also brings makes the file consistent with itself (where it otherwise
uses `is` to compare to `None`).