def err_func():
 err_func.counter += 1
 if (err_func.counter == 3):
  return True
 elif (err_func.counter == 2):
  raise TypeError
 else:
  raise errors.ConnectionFailure

def err_func ( ) : err_func . counter += 1 if ( err_func . counter == 3 ) : return True elif ( err_func . counter == 2 ) : raise TypeError else : raise errors . ConnectionFailure
helper function for retry_until_ok test .