def select_function(cache, function):
 fname = function.name.replace(u'-', u'_')
 try:
  func = cache.dispatch_map[fname]
 except KeyError:
  raise ExpressionError((u'The pseudo-class :%s() is unknown' % function.name))
 if (fname == u'lang'):
  items = frozenset(func(cache, function))
  for item in cache.iterparsedselector(function.selector):
   if (item in items):
    (yield item)
 else:
  for item in cache.iterparsedselector(function.selector):
   if func(cache, function, item):
    (yield item)

def select_function ( cache , function ) : fname = function . name . replace ( u'-' , u'_' ) try : func = cache . dispatch_map [ fname ] except KeyError : raise ExpressionError ( ( u'The pseudo-class :%s() is unknown' % function . name ) ) if ( fname == u'lang' ) : items = frozenset ( func ( cache , function ) ) for item in cache . iterparsedselector ( function . selector ) : if ( item in items ) : ( yield item ) else : for item in cache . iterparsedselector ( function . selector ) : if func ( cache , function , item ) : ( yield item )
select with a functional pseudo-class .