generalize getHosts