There is no threading in the public interface. Internally, threading supports exactly what you want you to write (at your own risk)
def thread_for_ident(ident): return threading._active.get(ident)
which will return None if such a stream does not exist. I do not think that you decision is actually too bad, until there are so many threads.
source share