code: def sparse(x, rho, penalty):
      
  
      lmbda = penalty / rho
      return (x - lmbda) * (x >= lmbda) + (x + lmbda) * (x <= -lmbda)
docs: Proximal operator for the l1-norm: soft thresholding
  
      Parameters
      ----------
      penalty : float
          Strength or weight on the l1-norm