code: def moment_censored(op, rv, dist, lower, upper):
      moment = pt.switch(
          pt.eq(lower, -np.inf),
          pt.switch(
              pt.isinf(upper),
              # lower = -inf, upper = inf
              0,
              # lower = -inf, upper = x
              upper - 1,
          ),
          pt.switch(
              pt.eq(upper, np.inf),
              # lower = x, upper = inf
              lower + 1,
              # lower = x, upper = x
              (lower + upper) / 2,
          ),
      )
      moment = pt.full_like(dist, moment)
      return moment
  
file_path: pymc/pymc/distributions/censored.py
imports: import numpy
  import pytensor.tensor
  from pytensor.tensor import TensorVariable
  from pytensor.tensor.random.op import RandomVariable
  from pymc.distributions.distribution import Distribution, SymbolicRandomVariable, _moment
  from pymc.distributions.shape_utils import _change_dist_size, change_dist_size
  from pymc.util import check_dist_not_registered
label_desc: Use image node_id 2 for calling a global function with example usage: moment_censored(op, rv, dist, lower, upper) and returns: moment