<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def search(self, term: str, case_sensitive: bool = False) -> 'PrettyDir': """Searches for names that match some pattern. Args: term: String used to match names. A name is returned if it matches the whole search term. case_sensitive: Boolean to match case or not, default is False (case insensitive). Return: A PrettyDir object with matched names. """

        if case_sensitive:
            return PrettyDir(
                self.obj, [pattr for pattr in self.pattrs if term in pattr.name]
            )
        else:
            term = term.lower()
            return PrettyDir(
                self.obj, [pattr for pattr in self.pattrs if term in pattr.name.lower()]
            )