This PR unifies `utilities.py`.

This PR is unifies `utilities.py`.  The goal is to avoid repetition and fragmentation of the several functions that are developed in parallel but with similar functionality.