def METHOD_NAME(factory: Callable[[], _T]) -> Callable[[], _T]:
    """
    Decorator for methods that create a particular value once and then return the same value in a thread safe way.
    :param factory: the method to decorate
    :return: a threadsafe singleton factory
    """
    lock = threading.RLock()
    instance: Value[_T] = Value()
    @functools.wraps(factory)
    def _singleton_factory() -> _T:
        if instance.is_set():
            return instance.get()
        with lock:
            if not instance:
                instance.set(factory())
            return instance.get()
    _singleton_factory.clear = instance.clear
    return _singleton_factory