Check item type (via) in Kicad 6.0

I’m trying to update my ViaStitching plugin to KiCAD 6.0.
Right now I’m stuck on this error:

That relates to these lines of code:

 for item in self.board.GetTracks():
            if type(item) is pcbnew.VIA:

How can I handle this on KiCAD 6.0?

Best regards,
Mike

for item in self.board.GetTracks():
        if item.GetClass() == 'PCB_VIA':