Return the result hash from format_hosts

The `format_hosts` function was returning the return value of `each_with_index` instead of the resulting hash that the loop constructs.