def _filters_to_query(self, includes, excludes, serializer, q=None):

        def rewrite_filters(filters, serializer):
            out = {}
            for k, node in six.iteritems(filters):
                filter_key = node.generate_query_key(serializer)
                out[filter_key] = node.value

            return out

        q = q or Q()

        if not includes and not excludes:
            return None

        if includes:
            includes = rewrite_filters(includes, serializer)
            q &= Q(**includes)
        if excludes:
            excludes = rewrite_filters(excludes, serializer)
            for k, v in six.iteritems(excludes):
                q &= ~Q(**{k: v})
        return q
If the C{stopOnFirstError} option is passed to C{runSequentially}, then
dataset/ETHPy150Open AltSchool/dynamic-rest/dynamic_rest/filters.py/DynamicFilterBackend._filters_to_query--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/trial/test/test_util.py/TestRunSequentially.test_stopOnFirstError