code: def moment(a, moment=1, axis=0):
      """
      Calculates the nth moment about the mean for a sample.
  
      Parameters
      ----------
      a : array_like
         data
      moment : int, optional
         order of central moment that is returned
      axis : int or None, optional
         Axis along which the central moment is computed. Default is 0.
         If None, compute over the whole array `a`.
  
      Returns
      -------
      n-th central moment : ndarray or float
         The appropriate moment along the given axis or over all values if axis
         is None. The denominator for the moment calculation is the number of
         observations, no degrees of freedom correction is done.
  
      Notes
      -----
      For more details about `moment`, see `stats.moment`.
  
      """
      a, axis = _chk_asarray(a, axis)
      if moment == 1:
          # By definition the first moment about the mean is 0.
          shape = list(a.shape)
          del shape[axis]
          if shape:
              # return an actual array of the appropriate shape
              return np.zeros(shape, dtype=float)
          else:
              # the input was 1D, so return a scalar instead of a rank-0 array
              return np.float64(0.0)
      else:
          # Exponentiation by squares: form exponent sequence
          n_list = [moment]
          current_n = moment
          while current_n > 2:
              if current_n % 2:
                  current_n = (current_n - 1) / 2
              else:
                  current_n /= 2
              n_list.append(current_n)
  
          # Starting point for exponentiation by squares
          a_zero_mean = a - ma.expand_dims(a.mean(axis), axis)
          if n_list[-1] == 1:
              s = a_zero_mean.copy()
          else:
              s = a_zero_mean**2
  
          # Perform multiplications
          for n in n_list[-2::-1]:
              s = s**2
              if n % 2:
                  s *= a_zero_mean
          return s.mean(axis)
  
imports: from __future__ import division, print_function, absolute_import
  import numpy
  from numpy import ndarray
  import numpy.ma
  from numpy.ma import masked, nomask
  from scipy._lib.six import iteritems
  import itertools
  import warnings
  from collections import namedtuple
  from .None import distributions
  import scipy.special
  from ._stats_mstats_common import _find_repeats, linregress, theilslopes, siegelslopes
label_desc: Use image node_id 42 for calling a global function with example usage: moment(a, moment, axis) and returns: s, np, np