Simplify python snippets.