def get_or_connect(self, address, authenticator=None):
if address in self.connections:<EOL><INDENT>return ImmediateFuture(self.connections[address])<EOL><DEDENT>else:<EOL><INDENT>with self._new_connection_mutex:<EOL><INDENT>if address in self._pending_connections:<EOL><INDENT>return self._pending_connections[address]<EOL><DEDENT>else:<EOL><INDENT>authenticator = authenticator or self._cluster_authenticator<EOL>try:<EOL><INDENT>translated_address = self._address_translator.translate(address)<EOL>if translated_address is None:<EOL><INDENT>raise ValueError("<STR_LIT>".format(address))<EOL><DEDENT>connection = self._new_connection_func(translated_address,<EOL>self._client.config.network_config.connection_timeout,<EOL>self._client.config.network_config.socket_options,<EOL>connection_closed_callback=self._connection_closed,<EOL>message_callback=self._client.invoker._handle_client_message,<EOL>network_config=self._client.config.network_config)<EOL><DEDENT>except IOError:<EOL><INDENT>return ImmediateExceptionFuture(sys.exc_info()[<NUM_LIT:1>], sys.exc_info()[<NUM_LIT:2>])<EOL><DEDENT>future = authenticator(connection).continue_with(self.on_auth, connection, address)<EOL>if not future.done():<EOL><INDENT>self._pending_connections[address] = future<EOL><DEDENT>return future<EOL><DEDENT><DEDENT><DEDENT>
Gets the existing connection for a given address. If it does not exist, the system will try to connect
asynchronously. In this case, it returns a Future. When the connection is established at some point in time, it
can be retrieved by using the get_connection(:class:`~hazelcast.core.Address`) or from Future.

:param address: (:class:`~hazelcast.core.Address`), the address to connect to.
:param authenticator: (Function), function to be used for authentication (optional).
:return: (:class:`~hazelcast.connection.Connection`), the existing connection or it returns a Future which includes asynchronously.