Various python code snippets