def _gather_metric(method, attribute=None, transform=None):
    doc = "Extract the {} attribute from the given process object".format
    if attribute:
        doc = "Extract the {}().{} attribute from the given process object".format

    def gather_metric():
        """Dynamically Generated """
        try:
            metric = methodcaller(method)   # pylint: disable=redefined-outer-name
            value = metric(psutil)
            if attribute:
                value = attrgetter(attribute)(value)
            if transform is not None:
                value = transform(value)
            yield value, None
        except RuntimeError, e:
            # Special case the expected exception we see if we call disk_io_counters without the
            # user executing 'diskperf -y' on their machine before use.  Yes, it is a hack relying
            # on the exception message, but sometimes you have to do what you have to do.  At least we
            # package a specific version of psutils in with the windows executable, so we should know if
            # the message changes.
            if e.message == "couldn't find any physical disk" and method == 'disk_io_counters':
                yield __NO_DISK_PERF__, None
            else:
                raise e

    gather_metric.__doc__ = doc(method, attribute)
    return gather_metric
Returns the unique stable identifier denoting this place.
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/windows_system_metrics.py/_gather_metric--crossover with--dataset/ETHPy150Open slimkrazy/python-google-places/googleplaces/__init__.py/Place.place_id