if threading:
            curthread = threading.currentThread()
            try:
                threadid = curthread.ident
            except AttributeError: