Revert "Fix unittest to import the correct CertificateError"

This reverts commit e663b3c077e01bc0f5a33ffb87c18173c2c1b6f7.
Revert "Fix cut and paste error"

This reverts commit fa73693a0f44bba05ec916f19e09bc68cb1b6007.
Revert the old method of choosing which ssl_math_hostname module to use.
Implement checking of which match_hostname function to use inside of the packages module.