def prepare_threads(new_function):
    """Replaces threading._get_ident() function in order to notify
    the waiting Condition."""
    with _waitforthreads_lock:
        if hasattr(threading, 'get_ident'):
            old_function = threading.get_ident
            threading.get_ident = new_function
        else:
            old_function = threading._get_ident
            threading._get_ident = new_function

        return old_function
def prepare_threads ( new_function ) : with _waitforthreads_lock : if hasattr ( threading , 'get_ident' ) : old_function = threading . get_ident threading . get_ident = new_function else : old_function = threading . _get_ident threading . _get_ident = new_function return old_function
Replaces threading._get_ident() function in order to notify
    the waiting Condition.