<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _filter_queues(self, queues):
 """ Applies the queue filter to the given list of queues and returns the queues that match. Note that a queue name matches any subqueues starting with the name, followed by a date. For example, "foo" will match both "foo" and "foo.bar". """


        def match(queue):
            """
            Returns whether the given queue should be included by checking each
            part of the queue name.
            """
            for part in reversed_dotted_parts(queue):
                if part in self.exclude_queues:
                    return False
                if part in self.only_queues:
                    return True
            return not self.only_queues

        return [q for q in queues if match(q)]