def retrieve(self, filter_expression=None,
                 order_expression=None, slice_key=None):
        """
        Retrieve entities from this cache, possibly after filtering, ordering
        and slicing.
        """
        ents = iter(self.__entities)
        if not filter_expression is None:
            ents = filter_expression(ents)
        if not order_expression is None:
            # Ordering always involves a copy and conversion to a list, so
            # we have to wrap in an iterator.
            ents = iter(order_expression(ents))
        if not slice_key is None:
            ents = islice(ents, slice_key.start, slice_key.stop)
        return ents