misc Python snippets