def METHOD_NAME(self):
    """Create a new dict for the current thread, and return it."""
    localdict = {}
    key = self.key
    thread = current_thread()
    idt = id(thread)
    def local_deleted(_, key=key):
        # When the localimpl is deleted, remove the thread attribute.
        thread = wrthread()
        if thread is not None:
            del thread.__dict__[key]
    def thread_deleted(_, idt=idt):
        # When the thread is deleted, remove the local dict.
        # Note that this is suboptimal if the thread object gets
        # caught in a reference loop. We would like to be called
        # as soon as the OS-level thread ends instead.
        local = wrlocal()
        if local is not None:
            dct = local.dicts.pop(idt)
    wrlocal = ref(self, local_deleted)
    wrthread = ref(thread, thread_deleted)
    thread.__dict__[key] = wrlocal
    self.dicts[idt] = wrthread, localdict
    return localdict