<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_query(self, query):
 """ Filter the given query using the filter classes specified on the view if any are specified. """


        for filter_class in list(self.filter_classes):
            query = filter_class().filter_query(self.request, query, self)

        return query