backport many ssl features from Python 3 (closes #21308)

A contribution of Alex Gaynor and David Reid with the generous support of
Rackspace. May God have mercy on their souls.
PyUnicode -> PyString and PyLong -> PyInt
link _ssl to crypt32.lib on windoze
allow any socket error for rude shutdown test
expect socket.error instead of the py3ism OSError