def blockingCallFromThread(reactor, f, *a, **kw):
 queue = Queue.Queue()
 def _callFromThread():
  result = defer.maybeDeferred(f, *a, **kw)
  result.addBoth(queue.put)
 reactor.callFromThread(_callFromThread)
 result = queue.get()
 if isinstance(result, failure.Failure):
  result.raiseException()
 return result

def blockingCallFromThread ( reactor , f , * a , ** kw ) : queue = Queue . Queue ( ) def _callFromThread ( ) : result = defer . maybeDeferred ( f , * a , ** kw ) result . addBoth ( queue . put ) reactor . callFromThread ( _callFromThread ) result = queue . get ( ) if isinstance ( result , failure . Failure ) : result . raiseException ( ) return result
run a function in the reactor from a thread .