Python: fixed a DeprecationWarning on Python 3.x