<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def constrain(value, lower=-np.Inf, upper=np.Inf, allow_equal=False):
 """ Apply interval constraint on stochastic value. """


    ok = flib.constrain(value, lower, upper, allow_equal)
    if ok == 0:
        raise ZeroProbability