def socket(self, family, sock_type):
        """Open and record a socket.

        Returns the actual underlying socket
        object to ensure e.g. selects and ssl wrapping works as expected.
        """
        self._target_afi = family  # Store the address family of the target
        afi, _, _, _, _ = self._proxy_addr
        self._sock = socket.socket(afi, sock_type)
        return self._sock
Open and record a socket.

        Returns the actual underlying socket
        object to ensure e.g. selects and ssl wrapping works as expected.
        
kafka/socks5_wrapper.py