Revert "remove general purpose function, as it will be in another snippet"

This reverts commit c7727292ec7d1f6d9db6c8c658786b86cceeb6b2.