def METHOD_NAME(filter_name, model_filter_arg, validator=None):
    def _consumer(key, value):
        if key != filter_name:
            return {}
        value = value.strip()
        if validator:
            try:
                validator(value)
            except ValidationError:
                raise BadRequest(SLUG_FILTER_ERROR_MESSAGE.format(value=value, filter_name=filter_name))
        return {model_filter_arg: value}
    return _consumer