def _build_compound_filter(spec, context):
    compound_type_map = {
        'or': ORFilter,
        'and': ANDFilter,
    }
    if compound_type_map not in spec['type']:
        raise BadSpecError(_('Complex filter type {0} must be one of the following choices ({1})').format(
            spec['type'],
            ', '.join(compound_type_map.keys())
        ))
    elif not isinstance(spec.get('filters'), list):
        raise BadSpecError(_('{0} filter type must include a "filters" list'.format(spec['type'])))

    filters = [FilterFactory.from_spec(subspec, context) for subspec in spec['filters']]
    return compound_type_map[spec['type']](filters)
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/userreports/filters/factory.py/_build_compound_filter/swapped operands of `not in`