User blog:QuasarBooster/Did I translate this mathematica code right?

I'm working on another piece of obfuscated code but I need help converting Wolfram code into Python. I looked at the basic documentation on their site but it's kind of a mess. Does this look about right? Mathematica (original): $RecursionLimit = Infinity; m[x_]:=Module[{y,v=2x-1,d,e}, If[x<0,-x, y=v-p[x-1];d=m[y];y=y+d; While[y=y-1/Denominator[y];2y>v, y=v-p[v-y];e=m[y]; d=Min[d,e];y=y+e]; d/2]]; p[x_]:=x+m[x]; Python 3 (my interpretation): def m(x): if x<0: return -x v=2*x-1 y=v-p(x-1) d=m(y) y+=d while y=y-1/denominator(y) and 2*y>v: y=v-p(v-y) e=m(y) d=min(d,e) y+=e return d/2 def p(x): return x+m(x)