def _kwswitch(kw, **kwargs):
 (keys, values) = list(zip(*sorted(kwargs.items())))
 match_idx = scope.call_method_pure(keys, 'index', kw)
 return scope.switch(match_idx, *values)

def _kwswitch ( kw , ** kwargs ) : ( keys , values ) = list ( zip ( * sorted ( kwargs . items ( ) ) ) ) match_idx = scope . call_method_pure ( keys , 'index' , kw ) return scope . switch ( match_idx , * values )
conditional evaluation according to string value .