code: def set_visible_func(self, visible_func):
          
          self.model_filter.set_visible_func(
                  self._internal_visible_func,
                  visible_func,
                  )
          self._visible_func = visible_func
          self.model_filter.refilter()
docs: Set the function to decide visibility of an item
  
          :param visible_func: A callable that returns a boolean result to
                               decide if an item should be visible, for
                               example::
  
                                  def is_visible(item):
                                      return True