General-purpose snippets of useful python code