<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def do_search(self, arg=None):
 """Do search and close panel"""

        new_cats = []
        for cat in self.cats:
            new_cat = cat.search(self.inputs.text,
                                 depth=self.inputs.depth)
            if len(list(new_cat)) > 0:
                new_cats.append(new_cat)
        if len(new_cats) > 0:
            self.done_callback(new_cats)
            self.visible = False