utility functions for python