def METHOD_NAME(self, filename, format, **kwargs):
    if filename.endswith(".bgz"):
        with gzip.open(filename) as handle:
            parsed = list(SearchIO.parse(handle, format, **kwargs))
    else:
        parsed = list(SearchIO.parse(filename, format, **kwargs))
    # compare values by index
    indexed = SearchIO.index(filename, format, **kwargs)
    self.assertEqual(
        len(parsed),
        len(indexed),
        "Should be %i records in %s, index says %i"
        % (len(parsed), filename, len(indexed)),
    )
    # compare values by index_db, only if sqlite3 is present
    if sqlite3 is not None:
        db_indexed = SearchIO.index_db(":memory:", [filename], format, **kwargs)
        self.assertEqual(
            len(parsed),
            len(db_indexed),
            "Should be %i records in %s, index_db says %i"
            % (len(parsed), filename, len(db_indexed)),
        )
    for qres in parsed:
        idx_qres = indexed[qres.id]
        # parsed and indexed qresult are different objects!
        self.assertNotEqual(id(qres), id(idx_qres))
        # but they should have the same attribute values
        self.compare_search_obj(qres, idx_qres)
        # sqlite3 comparison, only if it's present
        if sqlite3 is not None:
            dbidx_qres = db_indexed[qres.id]
            self.assertNotEqual(id(qres), id(dbidx_qres))
            self.compare_search_obj(qres, dbidx_qres)
    indexed.close()
    if sqlite3 is not None:
        db_indexed.close()
        db_indexed._con.close()
    if os.path.isfile(filename + ".bgz"):
        # Do the tests again with the BGZF compressed file
        print(f"[BONUS {filename}.bgz]")
        self.METHOD_NAME(filename + ".bgz", format, **kwargs)