code: def sparse_svd(sparse_matrix, num_values, max_iter):
    if num_values <= 0:
      raise ValueError("num_values should be > 0 but instead is %d." % num_values)
    if max_iter is not None and max_iter < 0:
      raise ValueError("max_iter should be >= 0 but instead is %d." % max_iter)
    if max_iter is None:
      max_iter = FLAGS.max_iter_sparse_svd
    elif not max_iter:
      max_iter = None
    u, s, v = linalg.svds(
        sparse_matrix, k=num_values, maxiter=max_iter,
        return_singular_vectors=True)
    return (u, s, v)