Using is not None instead of type is not NoneType to make Python 3 happy.