from interruptingcow import timeout
import time

while True:
    # simulate waiting for laser A
    print("Waiting for laser A")
    time.sleep(2)
    print("laser A tripped")
    try:
        with timeout(.25, exception=RuntimeError):
            # perform a potentially very slow operation
            print("Wait for laser B")
            time.sleep(2)
            print("laser B tripped, add 1 to DB")
            pass
    except RuntimeError:
        print "didn't finish within .25 seconds"

@@ -42,16 +42,65 @@
 t time%0A%0A
+# def bTripped():%0A#     +1 to DB%0A#     continue%0A%0A
 while Tr
@@ -218,16 +218,71 @@
 ipped%22)%0A
+    # Real code would be:%0A    # laserA.wait_for_dark()%0A
     try:
@@ -449,24 +449,24 @@
 me.sleep(2)%0A
-
             
@@ -499,24 +499,102 @@
 d 1 to DB%22)%0A
+            # Real code would be:%0A            # laserB.when_dark() = bTripped%0A
             

Add real code in comments.