code: def _tvl1_objective(X, y, w, alpha, l1_ratio, mask, loss="mse"):
      """Compute the TV-L1 squared loss regression objective functions.
  
      Returns
      -------
      float
          Value of TV-L1 penalty.
      """
      loss = loss.lower()
      if loss not in ["mse", "logistic"]:
          raise ValueError(
              f"loss must be one of 'mse' or 'logistic'; got '{loss}'"
          )
  
      if loss == "mse":
          out = squared_loss(X, y, w)
      else:
          out = logistic_loss(X, y, w)
          w = w[:-1]
  
      grad_id = gradient_id(
          unmask_from_to_3d_array(w, mask), l1_ratio=l1_ratio
      )
      out += alpha * _tvl1_objective_from_gradient(grad_id)
  
      return out
  
file_path: nilearn/nilearn/decoding/space_net_solvers.py
imports: from math import sqrt
  import numpy
  from nilearn.masking import unmask_from_to_3d_array
  from ._objective_functions import divergence, gradient, gradient_id, logistic_loss, logistic_loss_grad, logistic_loss_lipschitz_constant, spectral_norm_squared, squared_loss, squared_loss_grad
  from ._proximal_operators import prox_l1, prox_l1_with_intercept, prox_tvl1, prox_tvl1_with_intercept
  from .fista import mfista
label_desc: Use image node_id 12 for calling a global function with example usage: _tvl1_objective(X, y, w, alpha, l1_ratio, mask, loss) and returns: out