def join_thread(thr):
    # type: (threading.Thread) -> None
    """Join a thread
    :type threading.Thread thr: thread to join
    """
    if on_python2():
        while True:
            thr.join(timeout=1)
            if not thr.isAlive():
                break
    else:
        thr.join()
Join a thread
    :type threading.Thread thr: thread to join