def cached_property(property_name):
    """A memoize decorator for class properties."""
    @wraps(property_name)
    def cached_propery_get(self):
        try:
            return self._cache[property_name]
        except __HOLE__:
            self._cache = {}
        except KeyError:
            pass
        ret = self._cache[property_name] = property_name(self)
        return ret
    return property(cached_propery_get)
dataset/ETHPy150Open Impactstory/total-impact-webapp/util.py/cached_property