code: def _check_string_param(sparseness, solver):
      allowed_sparseness = (None, "data", "components")
      if sparseness not in allowed_sparseness:
          raise ValueError(
              "Invalid sparseness parameter: got %r instead of one of %r"
              % (sparseness, allowed_sparseness)
          )
  
      allowed_solver = ("pg", "cd")
      if solver not in allowed_solver:
          raise ValueError(
              "Invalid solver parameter: got %r instead of one of %r"
              % (solver, allowed_solver)
          )
  
imports: from __future__ import division, print_function
  from math import sqrt
  import warnings
  import numbers
  import numpy
  import scipy.sparse
  from ..base import BaseEstimator, TransformerMixin
  from ..utils import check_random_state, check_array
  from ..utils.extmath import randomized_svd, safe_sparse_dot, squared_norm
  from ..utils.extmath import fast_dot
  from ..utils.validation import check_is_fitted, check_non_negative
  from ..utils import deprecated
  from ..exceptions import ConvergenceWarning
  from .cdnmf_fast import _update_cdnmf_fast
label_desc: Use image node_id 7 for calling a global function with example usage: _check_string_param(sparseness, solver) without return types