Python utility functions