> Is it because if ssl_only is set it'll be type str not bool?

Yes.
I find that bool(...) is easier to read, kind of a return type of the code on the right.