Sandbox2utilities

Promoted some function from sandbox to `utilities.py`.