python snippets from official manual