def METHOD_NAME(name):
    def getter(self):
        value = getattr(self, name, None)
        if value is None:
            raise AttributeError(
                "'{}' not set.  Provide as argument "
                "to condition, or call 'prior' "
                "first".format(name.lstrip("_"))
            )
        else:
            return value
        return getattr(self, name)
    return getter