<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def select_leaves(self, name):
 """Returns all leaves under all nodes matching name """


        if self.is_leaf:
            return [self] if re.search(name, self.label) else []
        else:
            leaves = []
            if re.search(name, self.label):
                for c in self.children:
                    leaves += c._get_leaves() #all leaves
            else:
                for c in self.children:
                    leaves += c.select_leaves(name) #only matching ones
            return leaves