def cooperative_iter(iter):
 try:
  for chunk in iter:
   sleep(0)
   (yield chunk)
 except Exception as err:
  with excutils.save_and_reraise_exception():
   msg = (_LE('Error: cooperative_iter exception %s') % err)
   LOG.error(msg)

def cooperative_iter ( iter ) : try : for chunk in iter : sleep ( 0 ) ( yield chunk ) except Exception as err : with excutils . save_and_reraise_exception ( ) : msg = ( _LE ( 'Error: cooperative_iter exception %s' ) % err ) LOG . error ( msg )
return an iterator which schedules after each iteration .