py: More robust int conversion and overflow checking.
diff --git a/py/mpz.h b/py/mpz.h
index 7778893..cbe60eb 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -71,6 +71,7 @@
 mpz_t *mpz_mod(const mpz_t *lhs, const mpz_t *rhs);
 
 machine_int_t mpz_as_int(const mpz_t *z);
+bool mpz_as_int_checked(const mpz_t *z, machine_int_t *value);
 #if MICROPY_ENABLE_FLOAT
 mp_float_t mpz_as_float(const mpz_t *z);
 #endif