def _apply_unitary(val: Any, args: ApplyChannelArgs) -> np.ndarray | None:
    """Attempt to use `apply_unitary` and return the result.

    If `val` does not support `apply_unitary` returns None.
    """
    left_args = ApplyUnitaryArgs(
        target_tensor=args.target_tensor,
        available_buffer=args.auxiliary_buffer0,
        axes=args.left_axes,
    )
    left_result = apply_unitary(val, left_args, None)
    if left_result is None:
        return None
    right_args = ApplyUnitaryArgs(
        target_tensor=np.conjugate(left_result),
        available_buffer=args.out_buffer,
        axes=args.right_axes,
    )
    right_result = apply_unitary(val, right_args)
    np.conjugate(right_result, out=right_result)
    return right_result
Attempt to use `apply_unitary` and return the result.

    If `val` does not support `apply_unitary` returns None.
    
cirq-core/cirq/protocols/apply_channel_protocol.py