<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def verify(self):
        '''Check that the database accurately describes the state of the repository'''

        c = self.database.cursor()
        non_exist = set()

        no_db_entry = set(os.listdir(self.cache_dir))
        try:
            no_db_entry.remove('file_database.db')
            no_db_entry.remove('file_database.db-journal')
        except:
            pass

        for row in c.execute("SELECT path FROM files"):
            path = row[0]

            repo_path = os.path.join(self.cache_dir, path)

            if os.path.exists(repo_path):
                no_db_entry.remove(path)
            else:
                non_exist.add(path)

        if len(non_exist) > 0:
            raise Exception(
                "Found {} records in db for files that don't exist: {}" .format(
                    len(non_exist),
                    ','.join(non_exist)))

        if len(no_db_entry) > 0:
            raise Exception("Found {} files that don't have db entries: {}"
                            .format(len(no_db_entry), ','.join(no_db_entry)))