Are you using python 3?
I am, and I sure as fuck am not going to install python 2, one python installed on my pc is quite enough. One of the biggest differences between 2 and 3 is the way they treat character strings. In short, python3 is way fussier about converting to/from and comparing byte arrays and strings. This is a good thing, because though back in the day everything was ASCII and every written character was just one byte, nowadays strings are in UTF-8 and many other encodings, and a 4-character string like "CAL0" could be anywhere from 4 bytes to 32 bytes!
Anyway, on python 3 there needs to be a decode call added. On line 69, replace
ssl_test != 'CAL0'
with
ssl_test.decode('utf-8') != 'CAL0'
Since 'CAL0' is actually a character string, while ssl_test is a byte array, you must decode the byte array to a character string using the UTF8 encoding.
Alternately, leave that alone, and put a b in front of 'CAL0'.
ssl_test != b'CAL0'
That way, 'CAL0' is treated like a python2 byte string. ssl_test is also a python2 byte string, so the equality works that way too. Either fix should work. I tested it, and they both gave me a cert successfully.