+class Metric(object):
+ """Gets metrics from an object, scaling it by a factor."""
+ def __init__(self, obj, scale):
+ self._obj = obj
+ self._scale = float(scale)
+
+ def __getattr__(self, name):
+ src = getattr(self._obj, name)
+ if src and self._scale:
+ src = type(src)(self._scale * src)
+ return src
+
+