Python: addressing PEP8 deprecation