rewrite for pythonisms