Hello there
"R = E.lift_x(r)"
there are 2 possibilities in this line for point R
"R" or "-R"
If "public_key" is not a string but a "point" object(like G) with "E" element (Ellipric Curve)
"R= u2*public_key + u1*G"
it's the right thing to do.
Thank you.