<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def validate(self, corpus, catalogue):
 """Returns True if all of the files labelled in `catalogue` are up-to-date in the database. :param corpus: corpus of works :type corpus: `Corpus` :param catalogue: catalogue matching filenames to labels :type catalogue: `Catalogue` :rtype: `bool` """

        is_valid = True
        for name in catalogue:
            count = 0
            # It is unfortunate that this creates WitnessText objects
            # for each work, since that involves reading the file.
            for witness in corpus.get_witnesses(name):
                count += 1
                name, siglum = witness.get_names()
                filename = witness.get_filename()
                row = self._conn.execute(constants.SELECT_TEXT_SQL,
                                         [name, siglum]).fetchone()
                if row is None:
                    is_valid = False
                    self._logger.warning(
                        'No record (or n-grams) exists for {} in '
                        'the database'.format(filename))
                elif row['checksum'] != witness.get_checksum():
                    is_valid = False
                    self._logger.warning(
                        '{} has changed since its n-grams were '
                        'added to the database'.format(filename))
            if count == 0:
                raise FileNotFoundError(
                    constants.CATALOGUE_WORK_NOT_IN_CORPUS_ERROR.format(
                        name))
        return is_valid