def _mongo_client(host, port, authenticate=True, direct=False, **kwargs):
 client_options = client_context.ssl_client_options.copy()
 if (client_context.replica_set_name and (not direct)):
  client_options['replicaSet'] = client_context.replica_set_name
 client_options.update(kwargs)
 client = MongoClient(_connection_string(host, port, authenticate), port, **client_options)
 return client

def _mongo_client ( host , port , authenticate = True , direct = False , ** kwargs ) : client_options = client_context . ssl_client_options . copy ( ) if ( client_context . replica_set_name and ( not direct ) ) : client_options [ 'replicaSet' ] = client_context . replica_set_name client_options . update ( kwargs ) client = MongoClient ( _connection_string ( host , port , authenticate ) , port , ** client_options ) return client
create a new client over ssl/tls if necessary .