def get_port(self, for_protocol):
assert len(for_protocol) == <NUM_LIT:1>, "<STR_LIT>"<EOL>use_ssl = for_protocol in ('<STR_LIT:s>', '<STR_LIT:g>')<EOL>if '<STR_LIT:port>' in self: return self['<STR_LIT>'], int(self['<STR_LIT:port>']), use_ssl<EOL>rv = next(i for i in self['<STR_LIT>'] if i[<NUM_LIT:0>] == for_protocol)<EOL>port = None<EOL>if len(rv) >= <NUM_LIT:2>:<EOL><INDENT>try:<EOL><INDENT>port = int(rv[<NUM_LIT:1>:])<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>port = port or DEFAULT_PORTS[for_protocol]<EOL>return self['<STR_LIT>'], port, use_ssl<EOL>
Return (hostname, port number, ssl) pair for the protocol.
Assuming only one port per host.