Digital envelope implementation for Python