Some helpful utility functions in python