Some Python utility functions.