python rewrite, go is the wrong tool for this