Return the role and type for the transfer. Throws an exception on error

def role_from_transfer_task(transfer_task: TransferTask) -> str:
    """Return the role and type for the transfer. Throws an exception on error"""
    if isinstance(transfer_task, InitiatorTask):
        return 'initiator'
    if isinstance(transfer_task, MediatorTask):
        return 'mediator'
    if isinstance(transfer_task, TargetTask):
        return 'target'

    raise ValueError('Argument to role_from_transfer_task is not a TransferTask')