code: def handle(self,
                 t_input: inference.TranslatorInput,
                 t_output: inference.TranslatorOutput,
                 t_walltime: float = 0.):
          
          line = "{sent_id} ||| {target} ||| {score:f} ||| {source} ||| {source_len:d} ||| {target_len:d}\n"
          self.stream.write(line.format(sent_id=t_input.sentence_id,
                                        target=" ".join(t_output.tokens),
                                        score=t_output.score,
                                        source=" ".join(t_input.tokens),
                                        source_len=len(t_input.tokens),
                                        target_len=len(t_output.tokens)))
          attention_matrix = t_output.attention_matrix.T
          for i in range(0, attention_matrix.shape[0]):
              attention_vector = attention_matrix[i]
              self.stream.write(" ".join(["%f" % value for value in attention_vector]))
              self.stream.write("\n")
  
          self.stream.write("\n")
          self.stream.flush()
docs: :param t_input: Translator input.
          :param t_output: Translator output.
          :param t_walltime: Total wall-clock time for translation.