def _get_connection(self, cluster):
        """Return a connection to a Cluster.

        Return a MongoClient or a MongoReplicaSetClient for the given Cluster.
        This is done in a lazy manner (if there is already a Client connected to
        the Cluster, it is returned and no other Client is created).

        Args:
            cluster: A dict containing information about a cluster.

        Returns:
            A MongoClient or MongoReplicaSetClient instance connected to the
            desired cluster
        """
        # w=1 because:
        # http://stackoverflow.com/questions/14798552/is-mongodb-2-x-write-concern-w-1-truly-equals-to-safe-true
        if 'connection' not in cluster:
            cluster['connection'] = self._connection_class(
                socketTimeoutMS=self._network_timeout,
                w=1,
                j=self.j,
                **cluster['params'])

        return cluster['connection']
def _get_connection ( self , cluster ) : if 'connection' not in cluster : cluster [ 'connection' ] = self . _connection_class ( socketTimeoutMS = self . _network_timeout , w = 1 , j = self . j , ** cluster [ 'params' ] ) return cluster [ 'connection' ]
Return a connection to a Cluster.

        Return a MongoClient or a MongoReplicaSetClient for the given Cluster.
        This is done in a lazy manner (if there is already a Client connected to
        the Cluster, it is returned and no other Client is created).

        Args:
            cluster: A dict containing information about a cluster.

        Returns:
            A MongoClient or MongoReplicaSetClient instance connected to the
            desired cluster