def _get_datastore(self, datastore_name=None):
        """
        Returns the couch datastore instance and datastore name.
        This caches the datastore instance to avoid an explicit lookup to save on http request.
        The consequence is that if another process deletes the datastore in the meantime, we will fail later.
        """
        ds_name = self._get_datastore_name(datastore_name)

        if ds_name in self._datastore_cache:
            return self._datastore_cache[ds_name], ds_name

        try:
            if not self.datastore_exists(datastore_name):
                raise NotFound("Datastore '%s' does not exist" % ds_name)

            ds = self.server[ds_name]   # Note: causes http lookup
            self._datastore_cache[ds_name] = ds
            return ds, ds_name
        except __HOLE__:
            raise BadRequest("Datastore name '%s' invalid" % ds_name)
dataset/ETHPy150Open ooici/pyon/pyon/datastore/couchbase/base_store.py/CouchbaseDataStore._get_datastore