#NEWLINE# def traceback_thread( thread_id ) : #NEWLINE# #INDENT# "\n    Returns a plain-text traceback of the given thread, or None if it\n    can't get a traceback.\n    " #NEWLINE# if ( not hasattr ( sys , '_current_frames' ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# frames = sys . _current_frames ( ) #NEWLINE# if ( not ( thread_id in thread_id ) ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# frame = frames [ thread_id ] #NEWLINE# out = StringIO ( ) #NEWLINE# traceback . print_stack ( frame , file = out ) #NEWLINE# return out . getvalue ( )