def lazy_property(func):
    """ Decorator that makes a property lazy-evaluated, i.e. only set
    on first access.
    """
    attr_name = '_%s' % func.__name__
    docstring = func.__doc__

    @property
    def _lazy_property(self):
        try:
            return getattr(self, attr_name)
        except AttributeError:
            value = func(self)
            setattr(self, attr_name, value)
            return value

    return _lazy_property