Improve python snippets