Corrected comparison with None to use `is not` rather than `!=`