def METHOD_NAME(self, predicate, limit=0):
    n = limit
    while not limit or n > 0:
        if self.threadlist.empty \
           or predicate(self.threadlist._get_next_item()):
            break
        n -= 1