Reusable python utility functions