for i in range(order):
    result.cumsum(out=result)
result = array(result[decimation_factor - 1::decimation_factor])
for i in range(order):
    result[len(result) - 1:0:-1] -= result[len(result) - 2::-1]
result >>= outshift
result &= outmask
return result
Filtering signal with Python lfilter