Check out these classes. Not sure which if any are in python. https://www.lopp.net/bitcoin-information/online-offline-classes.html#technical