<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def discovery(self, compute_resource):
 """An example that discovers hosts and VMs in the inventory."""

        # Find the first ClusterComputeResource
        if compute_resource is None:
            cr_list = ComputeResource.all(self.client)
            print("ERROR: You must specify a ComputeResource.")
            print("Available ComputeResource's:")
            for cr in cr_list:
                print(cr.name)
            sys.exit(1)

        try:
            ccr = ComputeResource.get(self.client, name=compute_resource)
        except ObjectNotFoundError:
            print("ERROR: Could not find ComputeResource with name %s" %
                  compute_resource)
            sys.exit(1)

        print('Cluster: %s (%s hosts)' % (ccr.name, len(ccr.host)))

        ccr.preload("host", properties=["name", "vm"])
        for host in ccr.host:
            print('  Host: %s (%s VMs)' % (host.name, len(host.vm)))
            # Get the vm views in one fell swoop
            host.preload("vm", properties=["name"])
            for vm in host.vm:
                print('    VM: %s' % vm.name)