rewrite for python style