import sys, time

from twisted.internet.defer import Deferred

def start_chain(_):
    print "The start of the callback chain."

def blocking_poem(_):
    def delayed_write(s, delay):
        time.sleep(delay)
        sys.stdout.write(s)
        sys.stdout.flush()

    delayed_write('\n', 0)
    delayed_write('I', .6)
    delayed_write(' block', .4)
    delayed_write('\n  and', 1)
    delayed_write(' the', .4)
    delayed_write(' deferred', .6)
    delayed_write('\n  blocks', 1.5)
    delayed_write(' with', .2)
    delayed_write(' me', .2)
    delayed_write('\nas does', 1)
    delayed_write('\n the reactor', .6)
    delayed_write('\nkeep that', 1)
    delayed_write('\n factor', .6)
    delayed_write('\nin', 1)
    delayed_write(' mind', .4)
    delayed_write('\n\n', 2)

def end_chain(_):
    print "The end of the callback chain."


d = Deferred()

d.addCallback(start_chain)
d.addCallback(blocking_poem)
d.addCallback(end_chain)

print 'Firing deferred.'
d.callback(True)
print 'Firing finished.'

@@ -835,17 +835,76 @@
 chain.%22%0A
+    from twisted.internet import reactor%0A    reactor.stop()
 %0A
-
 %0Ad = Def
@@ -994,16 +994,32 @@
 chain)%0A%0A
+def fire():%0A    
 print 'F
@@ -1035,16 +1035,20 @@
 erred.'%0A
+    
 d.callba
@@ -1056,16 +1056,20 @@
 k(True)%0A
+    
 print 'F
@@ -1081,12 +1081,136 @@
  finished.'%0A
+%0Afrom twisted.internet import reactor%0A%0Areactor.callWhenRunning(fire)%0A%0Aprint 'Starting reactor.'%0Areactor.run()%0Aprint 'Done.'%0A

Use reactor in example.