code: def check_pdf(distfn, arg, msg):
      # compares pdf at median with numerical derivative of cdf
      median = distfn.ppf(0.5, *arg)
      eps = 1e-6
      pdfv = distfn.pdf(median, *arg)
      if (pdfv < 1e-4) or (pdfv > 1e4):
          # avoid checking a case where pdf is close to zero or
          # huge (singularity)
          median = median + 0.1
          pdfv = distfn.pdf(median, *arg)
      cdfdiff = (
          (
              distfn.cdf(median + eps, *arg)
              - distfn.cdf(median - eps, *arg)
          )
          / eps
          / 2.0
      )
      # replace with better diff and better test (more points),
      # actually, this works pretty well
      msg += " - cdf-pdf relationship"
      npt.assert_almost_equal(
          pdfv, cdfdiff, decimal=DECIMAL, err_msg=msg
      )
  
imports: import sys
  import numpy
  import numpy.testing
  import pytest
  from pytest import raises
  from scipy.integrate import IntegrationWarning
  import itertools
  from scipy import stats
  from .common_tests import check_normalization, check_moment, check_mean_expect, check_var_expect, check_skew_expect, check_kurt_expect, check_entropy, check_private_entropy, check_entropy_vect_scale, check_edge_support, check_named_args, check_random_state_property, check_meth_dtype, check_ppf_dtype, check_cmplx_deriv, check_pickling, check_rvs_broadcast, check_freezing, check_munp_expect
  from scipy.stats._distr_params import distcont
  from scipy.stats._distn_infrastructure import rv_continuous_frozen
label_desc: Use image node_id 23 for calling a global function with example usage: check_pdf(distfn, arg, msg) without return types