code: def check_var_expect(distfn, arg, m, v, msg):
      if np.isfinite(v):
          m2 = distfn.expect(lambda x: x * x, arg)
          npt.assert_almost_equal(
              m2,
              v + m * m,
              decimal=5,
              err_msg=msg + " - 2st moment (expect)",
          )
  
imports: from __future__ import division, print_function, absolute_import
  import pickle
  import numpy
  import numpy.testing
  from numpy.testing import assert_allclose, assert_equal
  from scipy._lib._numpy_compat import suppress_warnings
  from pytest import raises
  import numpy.ma.testutils
  from scipy._lib._util import getargspec_no_self
  from scipy import stats
label_desc: Use image node_id 5 for calling a global function with example usage: check_var_expect(distfn, arg, m, v, msg) without return types