def METHOD_NAME(fgraph, node):
    """Replace `AdvancedIncSubtensor` when using boolean indexing using `Switch`.
    JAX cannot JIT-compile functions that use boolean indexing to set values in
    an array. A workaround is to re-express this logic using `jax.numpy.where`.
    This rewrite allows to improve upon JAX's API.
    """
    # Get out if there is more than one indexing group
    if len(node.inputs) != 3:
        return None
    op = node.op
    [x, y, cond] = node.inputs
    # This rewrite only works when `y` is a scalar, so it can broadcast to the shape of x[cond]
    if y.type.ndim > 0:
        return
    if not isinstance(cond, TensorVariable):
        return
    if not cond.type.dtype == "bool":
        return
    if op.set_instead_of_inc:
        out = at.where(cond, y, x)
        return out.owner.outputs
    else:
        out = at.where(cond, x + y, x)
        return out.owner.outputs