Misc python snippets