code: def factorial_moment(X, n, condition=None, **kwargs):
      """
      The factorial moment is a mathematical quantity defined as the expectation
      or average of the falling factorial of a random variable.
  
      .. math::
          factorial-moment(X, n) = E(X(X - 1)(X - 2)...(X - n + 1))
  
      Parameters
      ==========
  
      n: A natural number, n-th factorial moment.
  
      condition : Expr containing RandomSymbols
              A conditional expression.
  
      Examples
      ========
  
      >>> from sympy.stats import factorial_moment, Poisson, Binomial
      >>> from sympy import Symbol, S
      >>> lamda = Symbol('lamda')
      >>> X = Poisson('X', lamda)
      >>> factorial_moment(X, 2)
      lamda**2
      >>> Y = Binomial('Y', 2, S.Half)
      >>> factorial_moment(Y, 2)
      1/2
      >>> factorial_moment(Y, 2, Y > 1) # find factorial moment for Y > 1
      2
  
      References
      ==========
  
      .. [1] https://en.wikipedia.org/wiki/Factorial_moment
      .. [2] https://mathworld.wolfram.com/FactorialMoment.html
      """
      return expectation(
          FallingFactorial(X, n), condition=condition, **kwargs
      )
  
imports: from sympy.sets import FiniteSet
  from sympy.core.numbers import Rational
  from sympy.core.relational import Eq
  from sympy.core.symbol import Dummy
  from sympy.functions.combinatorial.factorials import FallingFactorial
  from sympy.functions.elementary.exponential import exp, log
  from sympy.functions.elementary.miscellaneous import sqrt
  from sympy.functions.elementary.piecewise import piecewise_fold
  from sympy.integrals.integrals import Integral
  from sympy.solvers.solveset import solveset
  from .rv import probability, expectation, density, where, given, pspace, cdf, PSpace, characteristic_function, sample, sample_iter, random_symbols, independent, dependent, sampling_density, moment_generating_function, quantile, is_random, sample_stochastic_process
label_desc: Use image node_id 11 for calling a global function with example usage: factorial_moment(X, n, condition) and returns: expectation