def resolve_cert_reqs(candidate):
if candidate is None:<EOL><INDENT>return CERT_NONE<EOL><DEDENT>if isinstance(candidate, str):<EOL><INDENT>res = getattr(ssl, candidate, None)<EOL>if res is None:<EOL><INDENT>res = getattr(ssl, '<STR_LIT>' + candidate)<EOL><DEDENT>return res<EOL><DEDENT>return candidate<EOL>
Resolves the argument to a numeric constant, which can be passed to
the wrap_socket function/method from the ssl module.
Defaults to :data:`ssl.CERT_NONE`.
If given a string it is assumed to be the name of the constant in the
:mod:`ssl` module or its abbreviation.
(So you can specify `REQUIRED` instead of `CERT_REQUIRED`.
If it's neither `None` nor a string we assume it is already the numeric
constant which can directly be passed to wrap_socket.