def to_cli_filter(bool_or_filter):
 if (not isinstance(bool_or_filter, (bool, CLIFilter))):
  raise TypeError((u'Expecting a bool or a CLIFilter instance. Got %r' % bool_or_filter))
 return {True: _always, False: _never}.get(bool_or_filter, bool_or_filter)

def to_cli_filter ( bool_or_filter ) : if ( not isinstance ( bool_or_filter , ( bool , CLIFilter ) ) ) : raise TypeError ( ( u'Expecting a bool or a CLIFilter instance. Got %r' % bool_or_filter ) ) return { True : _always , False : _never } . get ( bool_or_filter , bool_or_filter )
accept both booleans and clifilters as input and turn it into a clifilter .