[SECP256K1] Convert Sage code to Python 3 (as used by Sage >= 9)
Summary: Backport of secp256k1#849
Test Plan:
Run from the sage dir
sage group_prover.sage sage weierstrass_prover.sage
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Differential Revision: https://reviews.bitcoinabc.org/D9374