<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def visualize_activation(model, layer_idx, filter_indices=None, wrt_tensor=None, seed_input=None, input_range=(0, 255), backprop_modifier=None, grad_modifier=None, act_max_weight=1, lp_norm_weight=10, tv_weight=10, **optimizer_params):
 """Generates the model input that maximizes the output of all `filter_indices` in the given `layer_idx`. Args: `image_data_format=channels_last`. layer_idx: The layer index within `model.layers` whose filters needs to be visualized. filter_indices: filter indices within the layer to be maximized. If None, all filters are visualized. (Default value = None) For `keras.layers.Dense` layer, `filter_idx` is interpreted as the output index. If you are visualizing final `keras.layers.Dense` layer, consider switching 'softmax' activation for 'linear' using [utils.apply_modifications](vis.utils.utils#apply_modifications) for better results. wrt_tensor: Short for, with respect to. The gradients of losses are computed with respect to this tensor. When None, this is assumed to be the same as `input_tensor` (Default value: None) seed_input: Seeds the optimization with a starting input. Initialized with a random value when set to None. (Default value = None) input_range: Specifies the input range as a `(min, max)` tuple. This is used to rescale the final optimized input to the given range. (Default value=(0, 255)) backprop_modifier: backprop modifier to use. See [backprop_modifiers](vis.backprop_modifiers.md). If you don't specify anything, no backprop modification is applied. (Default value = None) grad_modifier: gradient modifier to use. See [grad_modifiers](vis.grad_modifiers.md). If you don't specify anything, gradients are unchanged (Default value = None) act_max_weight: The weight param for `ActivationMaximization` loss. Not used if 0 or None. (Default value = 1) lp_norm_weight: The weight param for `LPNorm` regularization loss. Not used if 0 or None. (Default value = 10) tv_weight: The weight param for `TotalVariation` regularization loss. Not used if 0 or None. (Default value = 10) optimizer_params: The **kwargs for optimizer [params](vis.optimizer#optimizerminimize). Will default to reasonable values when required keys are not found. Example: If you wanted to visualize the input image that would maximize the output index 22, say on final `keras.layers.Dense` layer, then, `filter_indices = [22]`, `layer_idx = dense_layer_idx`. If `filter_indices = [22, 23]`, then it should generate an input image that shows features of both classes. Returns: The model input that maximizes the output of `filter_indices` in the given `layer_idx`. """

    if backprop_modifier is not None:
        modifier_fn = get(backprop_modifier)
        model = modifier_fn(model)

    losses = [
        (ActivationMaximization(model.layers[layer_idx], filter_indices), act_max_weight),
        (LPNorm(model.input), lp_norm_weight),
        (TotalVariation(model.input), tv_weight)
    ]

    # Add grad_filter to optimizer_params.
    optimizer_params = utils.add_defaults_to_kwargs({
        'grad_modifier': grad_modifier
    }, **optimizer_params)

    return visualize_activation_with_losses(model.input, losses, wrt_tensor,
                                            seed_input, input_range, **optimizer_params)