Find the batch number that contains a certain event.

        Parameters:
        uuid    -- the event uuid to search for.

        returns -- a batch number, or None if not found.

def _find_batch_containing_event(self, uuid):
        """Find the batch number that contains a certain event.

        Parameters:
        uuid    -- the event uuid to search for.

        returns -- a batch number, or None if not found.

        """
        if self.estore.key_exists(uuid):
            # Reusing already opened DB if possible
            return self.batchno
        else:
            for batchno in range(self.batchno - 1, -1, -1):
                # Iterating backwards here because we are more likely to find
                # the event in an later archive, than earlier.
                db = self._open_event_store(batchno)
                with contextlib.closing(db):
                    if db.key_exists(uuid):
                        return batchno
        return None