small python 3 refactor