If a certain node comes online:
    1. Check if a channel exists with that node
    2. Check that this channel is a route, check if the route is valid.
    3. Check that the transfer was stuck because there was no route available.
    4. Send the transfer again to this now-available route.

def handle_node_change_network_state(
        mediator_state: MediatorTransferState,
        state_change: ActionChangeNodeNetworkState,
        channelidentifiers_to_channels: ChannelMap,
        pseudo_random_generator: random.Random,
        block_number: BlockNumber,
) -> TransitionResult:
    """ If a certain node comes online:
    1. Check if a channel exists with that node
    2. Check that this channel is a route, check if the route is valid.
    3. Check that the transfer was stuck because there was no route available.
    4. Send the transfer again to this now-available route.
    """
    if state_change.network_state != NODE_NETWORK_REACHABLE:
        return TransitionResult(mediator_state, list())

    try:
        route = next(
            route for route in mediator_state.routes
            if route.node_address == state_change.node_address
        )
    except StopIteration:
        return TransitionResult(mediator_state, list())

    if mediator_state.waiting_transfer is None:
        return TransitionResult(mediator_state, list())

    transfer = mediator_state.waiting_transfer.transfer
    payer_channel_identifier = transfer.balance_proof.channel_identifier
    payer_channel = channelidentifiers_to_channels.get(payer_channel_identifier)
    payee_channel = channelidentifiers_to_channels.get(route.channel_identifier)

    if not payee_channel or not payer_channel:
        return TransitionResult(mediator_state, list())

    payee_channel_open = channel.get_status(payee_channel) == CHANNEL_STATE_OPENED
    if not payee_channel_open:
        return TransitionResult(mediator_state, list())

    return mediate_transfer(
        state=mediator_state,
        possible_routes=[route],
        payer_channel=payer_channel,
        channelidentifiers_to_channels=channelidentifiers_to_channels,
        nodeaddresses_to_networkstates={
            state_change.node_address: state_change.network_state,
        },
        pseudo_random_generator=pseudo_random_generator,
        payer_transfer=mediator_state.waiting_transfer.transfer,
        block_number=block_number,
    )