Given a payer transfer tries a new route to proceed with the mediation.

    Args:
        payer_transfer: The transfer received from the payer_channel.
        available_routes: Current available routes that may be used, it's
            assumed that the routes list is ordered from best to worst.
        channelidentifiers_to_channels: All the channels available for this
            transfer.
        pseudo_random_generator: Number generator to generate a message id.
        block_number: The current block number.

def forward_transfer_pair(
        payer_transfer: LockedTransferSignedState,
        available_routes: List['RouteState'],
        channelidentifiers_to_channels: Dict,
        pseudo_random_generator: random.Random,
        block_number: BlockNumber,
) -> Tuple[Optional[MediationPairState], List[Event]]:
    """ Given a payer transfer tries a new route to proceed with the mediation.

    Args:
        payer_transfer: The transfer received from the payer_channel.
        available_routes: Current available routes that may be used, it's
            assumed that the routes list is ordered from best to worst.
        channelidentifiers_to_channels: All the channels available for this
            transfer.
        pseudo_random_generator: Number generator to generate a message id.
        block_number: The current block number.
    """
    transfer_pair = None
    mediated_events: List[Event] = list()
    lock_timeout = BlockTimeout(payer_transfer.lock.expiration - block_number)

    payee_channel = next_channel_from_routes(
        available_routes=available_routes,
        channelidentifiers_to_channels=channelidentifiers_to_channels,
        transfer_amount=payer_transfer.lock.amount,
        lock_timeout=lock_timeout,
    )

    if payee_channel:
        assert payee_channel.settle_timeout >= lock_timeout
        assert payee_channel.token_address == payer_transfer.token

        message_identifier = message_identifier_from_prng(pseudo_random_generator)
        lock = payer_transfer.lock
        lockedtransfer_event = channel.send_lockedtransfer(
            channel_state=payee_channel,
            initiator=payer_transfer.initiator,
            target=payer_transfer.target,
            amount=get_lock_amount_after_fees(lock, payee_channel),
            message_identifier=message_identifier,
            payment_identifier=payer_transfer.payment_identifier,
            expiration=lock.expiration,
            secrethash=lock.secrethash,
        )
        assert lockedtransfer_event

        transfer_pair = MediationPairState(
            payer_transfer,
            payee_channel.partner_state.address,
            lockedtransfer_event.transfer,
        )

        mediated_events = [lockedtransfer_event]

    return (
        transfer_pair,
        mediated_events,
    )