<s> """<STR_LIT>""" <EOL> from twisted . internet . defer import succeed <EOL> from twisted . web import server <EOL> def _render ( resource , request ) : <EOL> result = resource . render ( request ) <EOL> if isinstance ( result , str ) : <EOL> request . write ( result ) <EOL> request . finish ( ) <EOL> return succeed ( None ) <EOL> elif result is server . NOT_DONE_YET : <EOL> if request . finished : <EOL> return succeed ( None ) <EOL> else : <EOL> return request . notifyFinish ( ) <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" % ( result , ) ) </s>
