def __new__(cls, name, bases, attrs):
    try:
        parents = [b for b in bases if issubclass(b, FilterSet)]
    except NameError:
        parents = None
    declared_filters = get_declared_filters(bases, attrs, False)
    new_class = super(FilterSetMetaclass, cls).__new__(cls, name, bases, attrs)
    if (not parents):
        return new_class
    opts = new_class._meta = FilterSetOptions(getattr(new_class, 'Meta', None))
    if opts.model:
        filters = filters_for_model(opts.model, opts.fields, opts.exclude, new_class.filter_for_field, new_class.filter_for_reverse_field)
        filters.update(declared_filters)
    else:
        filters = declared_filters
    if (None in filters.values()):
        raise TypeError("Meta.fields contains a field that isn't defined on this FilterSet")
    new_class.declared_filters = declared_filters
    new_class.base_filters = filters
    return new_class
def __new__(cls, name, bases, attrs):
    try:
        parents = [b for b in bases if issubclass(b, FilterSet)]
    except NameError:
        parents = None
    declared_filters = get_declared_filters(bases, attrs, False)
    new_class = super(FilterSetMetaclass, cls).__new__(cls, name, bases, attrs)
    if (not parents):
        return new_class
    opts = new_class._meta = FilterSetOptions(getattr(new_class, 'Meta', None))
    if opts.model:
        filters = filters_for_model(opts.model, opts.fields, opts.exclude, new_class.filter_for_field, new_class.filter_for_reverse_field)
        filters.update(declared_filters)
    else:
        filters = declared_filters
    if (None in filters.values()):
        raise TypeError("Meta.fields contains a field that isn't defined on this FilterSet")
    new_class.declared_filters = declared_filters
    new_class.base_filters = filters
    return new_class