def _writeFlattenedData(state, write, result):
 while True:
  try:
   element = next(state)
  except StopIteration:
   result.callback(None)
  except:
   result.errback()
  else:
   def cby(original):
    _writeFlattenedData(state, write, result)
    return original
   element.addCallbacks(cby, result.errback)
  break

def _writeFlattenedData ( state , write , result ) : while True : try : element = next ( state ) except StopIteration : result . callback ( None ) except : result . errback ( ) else : def cby ( original ) : _writeFlattenedData ( state , write , result ) return original element . addCallbacks ( cby , result . errback ) break
take strings from an iterator and pass them to a writer function .