Backwards-compatible check for Python none object in C++.

Refs #7019