I have with python:
e*d == 1%etf
we know (e) and (etf) and must discover (d) using the extended euclidean algorithm and the concept of mul
The trick you list with d = (e**(etf-2)) % etf will work only if etf is prime. If it's not, you have to use the EEA itself to find the modular multiplicative inverse.
d = (e**(etf-2)) % etf