Update testnet.py

Improved many things. Made more generic