Connects the socket to an IRC server.
        Required arguments:
        * server - Server to connect to.
        * port - Port to use.
        Optional arguments:
        * tls=True - Should we use TLS/SSL?
        * tls_verify=True - Verify the TLS certificate?
                Only works with Python 3.
        * proxy=False - Should we use a proxy?
        * proxy_type='SOCKS5' - Proxy type: SOCKS5, SOCKS4 or HTTP
        * proxy_server=None - Proxy server's address
        * proxy_port=None - Proxy server's port
        * proxy_username=None - If SOCKS5 is used,
                a proxy username/password can be specified.
        * proxy_password=None - If SOCKS5 is used,
                a proxy username/password can be specified.

def _connect(self, server, port, tls=True, tls_verify=True, proxy=False,
                 proxy_type='SOCKS5', proxy_server=None,
                 proxy_port=None, proxy_username=None, proxy_password=None):
        """
        Connects the socket to an IRC server.
        Required arguments:
        * server - Server to connect to.
        * port - Port to use.
        Optional arguments:
        * tls=True - Should we use TLS/SSL?
        * tls_verify=True - Verify the TLS certificate?
                Only works with Python 3.
        * proxy=False - Should we use a proxy?
        * proxy_type='SOCKS5' - Proxy type: SOCKS5, SOCKS4 or HTTP
        * proxy_server=None - Proxy server's address
        * proxy_port=None - Proxy server's port
        * proxy_username=None - If SOCKS5 is used,
                a proxy username/password can be specified.
        * proxy_password=None - If SOCKS5 is used,
                a proxy username/password can be specified.
        """
        with self.lock:
            if proxy:
                if proxy_type == 'SOCKS5':
                    proxy_type = self._m_proxy.PROXY_TYPE_SOCKS5
                elif proxy_type == 'SOCKS4':
                    proxy_type = self._m_proxy.PROXY_TYPE_SOCKS4
                elif proxy_type == 'HTTP':
                    proxy_type = self._m_proxy.PROXY_TYPE_HTTP
                self._socket = self._m_proxy.socksocket()
                self._socket.setproxy(proxytype=proxy_type, \
                                      addr=proxy_server, \
                                      port=proxy_port, \
                                      username=proxy_username, \
                                      password=proxy_password)

            if tls:
                if tls_verify:
                    ca_bundle = self._m_tempfile.NamedTemporaryFile().name
                    with open(ca_bundle, 'w') as bundle_file:
                        bundle_file.write(self._ca_bundle)
                    cert_required = self._m_tls.CERT_REQUIRED
                    self._socket = \
                    self._m_tls.wrap_socket(self._socket, \
                                            cert_reqs=cert_required, \
                                            ca_certs=ca_bundle)
                    self._socket.connect((server, port))
                    self._m_tls.match_hostname(self._socket.getpeercert(), \
                                               server)
                    return None
                else:
                    self._socket = self._m_tls.wrap_socket(self._socket)
            self._socket.connect((server, port))