#NEWLINE# def calledAsync( fn ) : #NEWLINE# #INDENT# '\n    Function wrapper that fires a deferred upon calling the given function.\n    ' #NEWLINE# d = defer . Deferred ( ) #NEWLINE# def func( * args , **kwargs ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = fn ( * args , ** kwargs ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# d . errback ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# d . callback ( result ) #NEWLINE# #UNINDENT# #UNINDENT# return ( d , func )