More robust check for Python version.