def value(self, item):
        # type: (Any) -> Any
        """
        Return value stored in weakref.
        :param item: Object from which get the value.
        :return: Value stored in the weakref, otherwise original value.
        :raise TreeDeletedException: when weakref is already deleted.
        """
        if isinstance(item, weakref.ReferenceType):
            if item() is None:
                raise TreeDeletedException()
            return item()
        return item