def verify_server(self, server_name, srv_type = '<STR_LIT>'):
server_jid = JID(server_name)<EOL>if "<STR_LIT>" not in self.alt_names and "<STR_LIT>" not in self.alt_namesand "<STR_LIT>" not in self.alt_names:<EOL><INDENT>return self.verify_jid_against_common_name(server_jid)<EOL><DEDENT>names = [name for name in self.alt_names.get("<STR_LIT>", [])<EOL>if not name.startswith("<STR_LIT>")]<EOL>names += self.alt_names.get("<STR_LIT>", [])<EOL>for name in names:<EOL><INDENT>logger.debug("<STR_LIT>".format(server_jid,<EOL>name))<EOL>try:<EOL><INDENT>jid = JID(name)<EOL><DEDENT>except ValueError:<EOL><INDENT>logger.debug("<STR_LIT>".format(name))<EOL>continue<EOL><DEDENT>if jid == server_jid:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>return True<EOL><DEDENT><DEDENT>if srv_type and self.verify_jid_against_srv_name(server_jid, srv_type):<EOL><INDENT>return True<EOL><DEDENT>wildcards = [name[<NUM_LIT:2>:] for name in self.alt_names.get("<STR_LIT>", [])<EOL>if name.startswith("<STR_LIT>")]<EOL>if not wildcards or not "<STR_LIT:.>" in server_jid.domain:<EOL><INDENT>return False<EOL><DEDENT>logger.debug("<STR_LIT>"<EOL>.format(server_jid, wildcards))<EOL>server_domain = JID(domain = server_jid.domain.split("<STR_LIT:.>", <NUM_LIT:1>)[<NUM_LIT:1>])<EOL>for domain in wildcards:<EOL><INDENT>logger.debug("<STR_LIT>".format(server_domain,<EOL>domain))<EOL>try:<EOL><INDENT>jid = JID(domain)<EOL><DEDENT>except ValueError:<EOL><INDENT>logger.debug("<STR_LIT>".format(name))<EOL>continue<EOL><DEDENT>if jid == server_domain:<EOL><INDENT>logger.debug("<STR_LIT>")<EOL>return True<EOL><DEDENT><DEDENT>return False<EOL>
Verify certificate for a server.

        :Parameters:
            - `server_name`: name of the server presenting the cerificate
            - `srv_type`: service type requested, as used in the SRV record
        :Types:
            - `server_name`: `unicode` or `JID`
            - `srv_type`: `unicode`

        :Return: `True` if the certificate is valid for given name, `False`
        otherwise.