code: def save_sentences(twg, stmts, filename, agent_limit=300):
      sentences = []
      unmapped_texts = [t[0] for t in twg]
      counter = 0
      logger.info('Getting sentences for top %d unmapped agent texts.' %
                  agent_limit)
      for text in unmapped_texts:
          agent_sentences = get_sentences_for_agent(text, stmts)
          sentences += map(lambda tup: (text,) + tup, agent_sentences)
          counter += 1
          if counter >= agent_limit:
              break
      write_unicode_csv(filename, sentences, delimiter=',', quotechar='"',
                        quoting=csv.QUOTE_MINIMAL, lineterminator='\r\n')