code: def check_moment(distfn, arg, m, v, msg):
      m1 = distfn.moment(1, *arg)
      m2 = distfn.moment(2, *arg)
      if not np.isinf(m):
          npt.assert_almost_equal(
              m1, m, decimal=10, err_msg=msg + " - 1st moment"
          )
      else:  # or np.isnan(m1),
          npt.assert_(
              np.isinf(m1),
              msg + " - 1st moment -infinite, m1=%s" % str(m1),
          )
  
      if not np.isinf(v):
          npt.assert_almost_equal(
              m2 - m1 * m1,
              v,
              decimal=10,
              err_msg=msg + " - 2ndt moment",
          )
      else:  # or np.isnan(m2),
          npt.assert_(
              np.isinf(m2),
              msg + " - 2nd moment -infinite, m2=%s" % str(m2),
          )
  
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 3 for calling a global function with example usage: check_moment(distfn, arg, m, v, msg) without return types