useful snippets of python code