def METHOD_NAME(filename, index=None):
    if filename.lower().endswith(".pgn"):
        chessfile = PGNFile(protoopen(addDataPrefix("learn/puzzles/%s" % filename)))
        chessfile.limit = 1000
        chessfile.init_tag_database()
    elif filename.lower().endswith(".olv"):
        chessfile = OLVFile(
            protoopen(addDataPrefix("learn/puzzles/%s" % filename), encoding="utf-8")
        )
    records, plys = chessfile.get_records()
    progress = puzzles_solving_progress.get(filename, [0] * chessfile.count)
    if index is None:
        try:
            index = progress.index(0)
        except ValueError:
            index = 0
    rec = records[index]
    timemodel = TimeModel(0, 0)
    gamemodel = LearnModel(timemodel)
    chessfile.loadToModel(rec, 0, gamemodel)
    start_puzzle_game(gamemodel, filename, records, index, rec)