Use "is None" instead of "== None"