'Read info about a specific host or VM from cache or VMware API.'

def get_host(self, hostname):

    inv = self._get_cache(hostname, None)
    if (inv is not None):
        return inv
    if (not self.guests_only):
        try:
            host = HostSystem.get(self.client, name=hostname)
            inv = self._get_host_info(host)
        except ObjectNotFoundError:
            pass
    if (inv is None):
        try:
            vm = VirtualMachine.get(self.client, name=hostname)
            inv = self._get_vm_info(vm)
        except ObjectNotFoundError:
            pass
    if (inv is not None):
        self._put_cache(hostname, inv)
    return (inv or {})
