code: def check_verbosity(
      verbose,
      evaluate_every,
      expected_lines,
      expected_perplexities,
      csr_container,
  ):
      n_components, X = _build_sparse_array(csr_container)
      lda = LatentDirichletAllocation(
          n_components=n_components,
          max_iter=3,
          learning_method="batch",
          verbose=verbose,
          evaluate_every=evaluate_every,
          random_state=0,
      )
      out = StringIO()
      old_out, sys.stdout = sys.stdout, out
      try:
          lda.fit(X)
      finally:
          sys.stdout = old_out
  
      n_lines = out.getvalue().count("\n")
      n_perplexity = out.getvalue().count("perplexity")
      assert expected_lines == n_lines
      assert expected_perplexities == n_perplexity
  
imports: import sys
  from io import StringIO
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from scipy.linalg import block_diag
  from scipy.special import psi
  from sklearn.decomposition import LatentDirichletAllocation
  from sklearn.decomposition._online_lda_fast import _dirichlet_expectation_1d, _dirichlet_expectation_2d
  from sklearn.exceptions import NotFittedError
  from sklearn.utils._testing import assert_allclose, assert_almost_equal, assert_array_almost_equal, if_safe_multiprocessing_with_blas
  from sklearn.utils.fixes import CSR_CONTAINERS
label_desc: Use image node_id 21 for calling a global function with example usage: check_verbosity(verbose, evaluate_every, expected_lines, expected_perplexities, csr_container) without return types