def simplefilter(action, category=Warning, lineno=0, append=0):
 assert (action in ('error', 'ignore', 'always', 'default', 'module', 'once')), ('invalid action: %r' % (action,))
 assert (isinstance(lineno, int) and (lineno >= 0)), 'lineno must be an int >= 0'
 item = (action, None, category, None, lineno)
 if append:
  filters.append(item)
 else:
  filters.insert(0, item)

def simplefilter ( action , category = Warning , lineno = 0 , append = 0 ) : assert ( action in ( 'error' , 'ignore' , 'always' , 'default' , 'module' , 'once' ) ) , ( 'invalid action: %r' % ( action , ) ) assert ( isinstance ( lineno , int ) and ( lineno >= 0 ) ) , 'lineno must be an int >= 0' item = ( action , None , category , None , lineno ) if append : filters . append ( item ) else : filters . insert ( 0 , item )
decorator that converts a function into a filter:: @simplefilter def lowercase: for ttype .