def lazyprop(func):
    """Wraps a property so it is lazily evaluated.

    Args:
        func: The property to wrap.

    Returns:
        A property that only does computation the first time it is called.
    """
    attr_name = '_lazy_' + func.__name__
    @property
    def _lazyprop(self):
        """A lazily evaluated propery.
        """
        if not hasattr(self, attr_name):
            setattr(self, attr_name, func(self))
        return getattr(self, attr_name)
    return _lazyprop