Miscellaneous Python code.