def filter_other_params(queryset, other_params, db_columns):
    """applyes a dictionary filter to the query set. Does some domain specific
    parsing,
       mostly to remove extra query params and deal with ranges.
       Ranges should be passed in as '<field name>__lte' or '<field name>__gte'
           e.g. other_params = {'gross_floor_area__lte': 50000}

    :param Django Queryset queryset: queryset to be filtered
    :param dict other_params: dictionary to be parsed and applied to filter.
    :param dict db_columns: list of column names, extra_data blob outsite these
    :returns: Django Queryset:
    """
    def strip_suffix(k, suffix):
        match = k.find(suffix)
        if match >= 0:
            return k[:match]
        else:
            return k

    def strip_suffixes(k, suffixes):
        return reduce(strip_suffix, suffixes, k)

    def is_column(k, columns):
        sanitized = strip_suffixes(k, ['__lt', '__gt', '__lte', '__gte'])
        if sanitized in columns:
            return True
        else:
            return False

    query_dict = {}
    for k, v in other_params.iteritems():
        in_columns = is_column(k, db_columns)
        if in_columns and k != 'q' and v is not None and v != '':
            if (k in '__lt' or
                '__lte' in k or
                '__gt' in k or
                '__gte' in k or
                '__isnull' in k or
               k == 'import_file_id' or k == 'source_type'):
                query_dict["%s" % k] = v
            else:
                query_dict["%s__icontains" % k] = v

    queryset = queryset.filter(**query_dict)

    # handle extra_data with json_query
    for k, v in other_params.iteritems():
        if (not is_column(k, db_columns)) and k != 'q' and v != '':
            if k.endswith(('__gt', '__gte')):
                k = strip_suffixes(k, ['__gt', '__gte'])
                cond = '>'
                key_cast = 'float'
            elif k.endswith(('__lt', '__lte')):
                k = strip_suffixes(k, ['__lt', '__lte'])
                cond = '<'
                key_cast = 'float'
            else:
                cond = 'LIKE'
                key_cast = 'text'
                v = "%{0}%".format(v)
            case_insensitive = key_cast == 'text'

            queryset = queryset.json_query(
                k,
                cond=cond,
                key_cast=key_cast,
                value=v,
                case_insensitive=case_insensitive,
            )

    return queryset
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/search.py/filter_other_params/swapped operands of `in`