def _get_qe(self, key, obj):
        """Instantiate a query engine, or retrieve a cached one.
        """
        if key in self._cached:
            return self._cached[key]
        qe = create_query_engine(obj, self._class)
        self._cached[key] = qe
        return qe