Check whether a key exists in the event store.

        Returns True if it does, False otherwise.

def key_exists(self, key):
        """Check whether a key exists in the event store.

        Returns True if it does, False otherwise.

        """
        assert isinstance(key, str)
        cursor = self.conn.cursor()
        with contextlib.closing(cursor):
            cursor.execute('SELECT COUNT(*) FROM events WHERE uuid=?', (key,))
            res = cursor.fetchone()
            count = res[0]
        if count == 0:
            return False
        else:
            assert count in (0, 1), \
                "Duplicate event ids detected: {0}".format(count)
            return True