'Given a dictionary of filters, create the necessary ORM-level filters.
Keys should be resource fields, **NOT** model fields.
Valid values are either a list of Django filter types (i.e.
``[\'startswith\', \'exact\', \'lte\']``), the ``ALL`` constant or the
``ALL_WITH_RELATIONS`` constant.'

def build_filters(self, filters=None, ignore_bad_filters=False):

    if (filters is None):
        filters = {}
    qs_filters = {}
    query_terms = QUERY_TERMS
    if ((django.VERSION >= (1, 8)) and GeometryField):
        query_terms |= set(GeometryField.class_lookups.keys())
    for (filter_expr, value) in filters.items():
        filter_bits = filter_expr.split(LOOKUP_SEP)
        field_name = filter_bits.pop(0)
        filter_type = u'exact'
        if (field_name not in self.fields):
            continue
        if (len(filter_bits) and (filter_bits[(-1)] in query_terms)):
            filter_type = filter_bits.pop()
        try:
            lookup_bits = self.check_filtering(field_name, filter_type, filter_bits)
        except InvalidFilterError:
            if ignore_bad_filters:
                continue
            else:
                raise
        value = self.filter_value_to_python(value, field_name, filters, filter_expr, filter_type)
        db_field_name = LOOKUP_SEP.join(lookup_bits)
        qs_filter = (u'%s%s%s' % (db_field_name, LOOKUP_SEP, filter_type))
        qs_filters[qs_filter] = value
    return dict_strip_unicode_keys(qs_filters)
