changed `!= None` to `is not None` (avoid future elementwise comparison)