def METHOD_NAME(client):
    with client.get_executor(pure=False) as e:
        fut = e.submit(sleep, 2.0)
        start = time()
        while number_of_processing_tasks(client) == 0:
            assert time() < start + 30
            sleep(0.01)
        assert not fut.done()
        fut.cancel()
        assert fut.cancelled()
        start = time()
        while number_of_processing_tasks(client) != 0:
            assert time() < start + 30
            sleep(0.01)
        with pytest.raises(CancelledError):
            fut.result()