Move some code to eastwood.utils

in preparation for using it in other namespaces.