find item in wx.TreeListCtrl by pydata code snippet

Hello list,

here is a small code snippet to recursively search a wx.TreeListCtrl for an
item with specific pydata.

Feel free to comment!

def recursiveFindItemByPydata(self, parent, pydata):
    item, cookie = self.GetFirstChild(parent)
    while item:
        if self.GetPyData(item) == pydata:
                return item
                                
        if self.ItemHasChildren(item):
            found = self.recursiveFindItemByPydata(item, pydata)
            if found is not None:
                return found
              
        item, cookie = self.GetNextChild(parent, cookie)
    return None

HAND

Johannes