Miscellaneous convenience, extension and workaround code for Python