code: def check_distribution_rvs(distfn, args, alpha, rvs):
      ## signature changed to avoid calling a distribution by name
      # test from scipy.stats.tests
      # this version reuses existing random variables
      D, pval = stats.kstest(rvs, distfn.cdf, args=args, N=1000)
      if pval < alpha:
          D, pval = stats.kstest(
              distfn.rvs, distfn.cdf, args=args, N=1000
          )
          npt.assert_(
              pval > alpha,
              "D = "
              + str(D)
              + "; pval = "
              + str(pval)
              + "; alpha = "
              + str(alpha)
              + "\nargs = "
              + str(args),
          )
  
imports: import warnings
  import numpy
  from numpy.testing import assert_equal, assert_raises, assert_allclose
  import numpy.testing
  from scipy.special import gamma, factorial, factorial2
  import scipy.stats
  from statsmodels.distributions.edgeworth import _faa_di_bruno_partitions, cumulant_from_moments, ExpandedNormal
label_desc: Use image node_id 8 for calling a global function with example usage: check_distribution_rvs(distfn, args, alpha, rvs) without return types