Fix deprecation warning in Python 3