code: def prox_l2(v, alpha, axis=None):
      r
  
      a = np.sqrt(np.sum(v**2, axis=axis, keepdims=True))
      b = np.maximum(0, a - alpha)
      b = sl.zdivide(b, a)
      return np.asarray(b * v, dtype=v.dtype)
docs: r"""Compute the proximal operator of the :math:`\ell_2` norm (vector
      shrinkage/soft thresholding)
  
      .. math::
       \mathrm{prox}_{\alpha f}(\mathbf{v}) = \mathcal{S}_{2,\alpha}
       (\mathbf{v}) = \frac{\mathbf{v}} {\|\mathbf{v}\|_2} \max(0,
       \|\mathbf{v}\|_2 - \alpha) \;,
  
      where :math:`f(\mathbf{x}) = \|\mathbf{x}\|_2`.
  
  
      Parameters
      ----------
      v : array_like
        Input array :math:`\mathbf{v}`
      alpha : float or array_like
        Parameter :math:`\alpha`
      axis : None or int or tuple of ints, optional (default None)
        Axes of `v` over which to compute the :math:`\ell_2` norm. If
        `None`, an entire multi-dimensional array is treated as a
        vector. If axes are specified, then distinct norm values are
        computed over the indices of the remaining axes of input array
        `v`, which is equivalent to the proximal operator of the sum over
        these values (i.e. an :math:`\ell_{2,1}` norm).
  
      Returns
      -------
      x : ndarray
        Output array