def label_for_filter(model, field_name, lookup_expr, exclude=False):
 name = verbose_field_name(model, field_name)
 verbose_expression = ([_('exclude'), name] if exclude else [name])
 if isinstance(lookup_expr, six.string_types):
  verbose_expression += [verbose_lookup_expr(lookup_expr)]
 verbose_expression = [force_text(part) for part in verbose_expression if part]
 verbose_expression = pretty_name(' '.join(verbose_expression))
 return verbose_expression

def label_for_filter ( model , field_name , lookup_expr , exclude = False ) : name = verbose_field_name ( model , field_name ) verbose_expression = ( [ _ ( 'exclude' ) , name ] if exclude else [ name ] ) if isinstance ( lookup_expr , six . string_types ) : verbose_expression += [ verbose_lookup_expr ( lookup_expr ) ] verbose_expression = [ force_text ( part ) for part in verbose_expression if part ] verbose_expression = pretty_name ( ' ' . join ( verbose_expression ) ) return verbose_expression
create a generic label suitable for a filter .