def complex_filter(self, filter_obj):
        if isinstance(filter_obj, Q) or hasattr(filter_obj, 'add_to_query'):
            clone = self._clone()
            clone.query.add_q(filter_obj)
            return clone
        else:
            return self._filter_or_exclude(None, **filter_obj)
Returns a new QuerySet instance with filter_obj added to the filters.
dataset/ETHPy150Open django/django/django/db/models/query.py/QuerySet.complex_filter