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: from __future__ import division, print_function, absolute_import
  import numpy
  import numpy.testing
  import pytest
  from pytest import raises
  from scipy._lib._numpy_compat import suppress_warnings
  from scipy.integrate import IntegrationWarning
  from scipy import stats
  from scipy.special import betainc
  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
  from scipy.stats._distr_params import distcont
label_desc: Use image node_id 13 for calling a global function with example usage: check_pdf(distfn, arg, msg) without return types