The reason the crypto module was using this particular deprecated feature is that it hasn't been updated at all in 8 years.
The OP should have dropped it because it's unmaintained, and a maintained replacement has existed for a long time: https://cryptography.io/
This is an especially important consideration for security-critical libraries like cryptographic libraries.