Various indispensable python utility functions