miscellany of Python code