<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, request, query, view):
 """ You may want to override this method if you want to add custom filtering to an ViewSet while still utilizing the feature of the ``AttributeFilter`` implementation. :param request: The pyramid ``Request`` instance. :param query: The SQLAlchemy ``Query`` instance. :param view: An instance of the view class that the filter has been applied to. :return: The filtered query. """


        if not request.params:
            return query

        querystring_params = self.parse_query_string(request.params)
        query, filter_list = self.build_filter_list(querystring_params, query, view)

        return self.apply_filter(query, filter_list)