def submit_and_wait_for_completion(unit_test, connection, start, end, increment, precision, split_range=False):
 pending_callbacks = []
 completed_callbacks = []
 for gross_time in range(start, end, increment):
  timeout = get_timeout(gross_time, start, end, precision, split_range)
  callback = TimerCallback(timeout)
  connection.create_timer(timeout, callback.invoke)
  pending_callbacks.append(callback)
 while (len(pending_callbacks) is not 0):
  for callback in pending_callbacks:
   if callback.was_invoked():
    pending_callbacks.remove(callback)
    completed_callbacks.append(callback)
  time.sleep(0.1)
 for callback in completed_callbacks:
  unit_test.assertAlmostEqual(callback.expected_wait, callback.get_wait_time(), delta=0.15)

def submit_and_wait_for_completion ( unit_test , connection , start , end , increment , precision , split_range = False ) : pending_callbacks = [ ] completed_callbacks = [ ] for gross_time in range ( start , end , increment ) : timeout = get_timeout ( gross_time , start , end , precision , split_range ) callback = TimerCallback ( timeout ) connection . create_timer ( timeout , callback . invoke ) pending_callbacks . append ( callback ) while ( len ( pending_callbacks ) is not 0 ) : for callback in pending_callbacks : if callback . was_invoked ( ) : pending_callbacks . remove ( callback ) completed_callbacks . append ( callback ) time . sleep ( 0.1 ) for callback in completed_callbacks : unit_test . assertAlmostEqual ( callback . expected_wait , callback . get_wait_time ( ) , delta = 0.15 )
this will submit a number of timers to the provided connection .