def run_threads(collection, target):
    threads = []
    for i in range(NTHREADS):
        bound_target = partial(target, collection, i)
        threads.append(threading.Thread(target=bound_target))

    for t in threads:
        t.start()

    for t in threads:
        t.join(30)
        assert not t.isAlive()
Run a target function in many threads.
dataset/ETHPy150Open mongodb/mongo-python-driver/test/utils.py/run_threads