code: def evaluate_moment(
          distribution,
          k_data,
          parameters=None,
          cache=None,
  ):
      
      logger = logging.getLogger(__name__)
      assert len(k_data) == len(distribution), (
          "distribution %s is not of length %d" % (distribution, len(k_data)))
      assert len(k_data.shape) == 1
  
      if numpy.all(k_data == 0):
          return 1.
  
      def cache_key(distribution):
          return (tuple(k_data), distribution)
  
      if cache is None:
          cache = {}
      else:
          if cache_key(distribution) in cache:
              return cache[cache_key(distribution)]
  
      from .. import baseclass
      try:
          parameters = load_parameters(
              distribution, "_mom", parameters, cache, cache_key)
          out = distribution._mom(k_data, **parameters)
  
      except baseclass.StochasticallyDependentError:
  
          logger.warning(
              "Distribution %s has stochastic dependencies; "
              "Approximating moments with quadrature.", distribution)
          from .. import approximation
          out = approximation.approximate_moment(distribution, k_data)
  
      if isinstance(out, numpy.ndarray):
          out = out.item()
  
      cache[cache_key(distribution)] = out
  
      return out
docs: Evaluate raw statistical moments.
  
      Args:
          distribution (Dist):
              Distribution to evaluate.
          x_data (numpy.ndarray):
              Locations for where evaluate moment of.
          parameters (:py:data:typing.Any):
              Collection of parameters to override the default ones in the
              distribution.
          cache (:py:data:typing.Any):
              A collection of previous calculations in case the same distribution
              turns up on more than one occasion.
  
      Returns:
          The raw statistical moment of ``distribution`` at location ``x_data``
          using parameters ``parameters``.