This can likely be shipped as binary code without dependencies like python, as the bug is in the kernel.
C version here: https://gist.github.com/alufers/921cd6c4b606c5014d6cc61eefb0...
[dead]
C version here: https://gist.github.com/alufers/921cd6c4b606c5014d6cc61eefb0...
[dead]