'This method should only be called once, before the connection is used.'

def set_cert(self, key_file=None, cert_file=None, cert_reqs=None, ca_certs=None, assert_hostname=None, assert_fingerprint=None, ca_cert_dir=None):

    if (cert_reqs is None):
        if (ca_certs or ca_cert_dir):
            cert_reqs = 'CERT_REQUIRED'
        elif (self.ssl_context is not None):
            cert_reqs = self.ssl_context.verify_mode
    self.key_file = key_file
    self.cert_file = cert_file
    self.cert_reqs = cert_reqs
    self.assert_hostname = assert_hostname
    self.assert_fingerprint = assert_fingerprint
    self.ca_certs = (ca_certs and os.path.expanduser(ca_certs))
    self.ca_cert_dir = (ca_cert_dir and os.path.expanduser(ca_cert_dir))
