def METHOD_NAME(
    exploiter_config,
    callback,
    scan_completed,
    stop,
    hosts_to_exploit,
):
    callback_barrier_count = 2
    def _callback(*_):
        # Block all threads here until 2 threads reach this barrier, then set stop
        # and test that neither thread continues to scan.
        _callback.barrier.wait()
        stop.set()
    _callback.barrier = Barrier(callback_barrier_count)
    stoppable_callback = MagicMock(side_effect=_callback)
    # Intentionally NOT setting scan_completed.set(); _callback() will set stop
    e = Exploiter(MockPuppet(), callback_barrier_count + 2)
    e.exploit_hosts(
        exploiter_config, hosts_to_exploit, 1, SERVERS, stoppable_callback, scan_completed, stop
    )
    assert stoppable_callback.call_count == 2