(maint) Move utility functions to their own file

This moves the utility functions to their own file and adds some better
error message by telling the user exactly what names were invalid when
failing to fetch vms.