def resource(self):
        """
        :class:`~zhmcclient.BaseResource`: The Python resource object of the
          resource these metric values apply to.

        Raises:

          :exc:`~zhmcclient.NotFound`: No resource found for this URI in the
            management scope of the HMC.
        """
        if self._resource is not None:
            return self._resource

        resource_class = self.metric_group_definition.resource_class
        resource_uri = self.resource_uri

        if resource_class == 'cpc':
            filter_args = {'object-uri': resource_uri}
            resource = self.client.cpcs.find(**filter_args)
        elif resource_class == 'logical-partition':
            for cpc in self.client.cpcs.list():
                try:
                    filter_args = {'object-uri': resource_uri}
                    resource = cpc.lpars.find(**filter_args)
                    break
                except NotFound:
                    pass  # Try next CPC
            else:
                raise
        elif resource_class == 'partition':
            for cpc in self.client.cpcs.list():
                try:
                    filter_args = {'object-uri': resource_uri}
                    resource = cpc.partitions.find(**filter_args)
                    break
                except NotFound:
                    pass  # Try next CPC
            else:
                raise
        elif resource_class == 'adapter':
            for cpc in self.client.cpcs.list():
                try:
                    filter_args = {'object-uri': resource_uri}
                    resource = cpc.adapters.find(**filter_args)
                    break
                except NotFound:
                    pass  # Try next CPC
            else:
                raise
        elif resource_class == 'nic':
            for cpc in self.client.cpcs.list():
                found = False
                for partition in cpc.partitions.list():
                    try:
                        filter_args = {'element-uri': resource_uri}
                        resource = partition.nics.find(**filter_args)
                        found = True
                        break
                    except NotFound:
                        pass  # Try next partition / next CPC
                if found:
                    break
            else:
                raise
        else:
            raise ValueError(
                "Invalid resource class: {!r}".format(resource_class))

        self._resource = resource
        return self._resource