def do_one(*brules):
 def do_one_brl(expr):
  yielded = False
  for brl in brules:
   for nexpr in brl(expr):
    yielded = True
    (yield nexpr)
   if yielded:
    return
 return do_one_brl

def do_one ( * brules ) : def do_one_brl ( expr ) : yielded = False for brl in brules : for nexpr in brl ( expr ) : yielded = True ( yield nexpr ) if yielded : return return do_one_brl
execute one of the branching rules .