Fixed Python version check to keep working for Python 4+

This changes ensures the library keeps working in Python 4+.