def run_with_constant_network_prediction(coroutine, logits):
    """Runs a coroutine with a constant response.

    Args:
        coroutine: Coroutine yielding network requests.
        logits: Response to send to every request.

    Returns:
        Return value of the coroutine.
    """
    try:
        next(coroutine)
        coroutine.send(logits)
        assert False, 'Coroutine should return after the first prediction.'
    except StopIteration as e:
        return e.value