code: def _translate_output_is_valid(translate_outputs: List[str]) -> bool:
      """
      True if there are invalid tokens in out_path, or if no valid outputs were found.
      """
      # At least one output must be non-empty
      found_valid_output = False
      bad_tokens = set(C.VOCAB_SYMBOLS)
      for json_output in translate_outputs:
          if json_output and "translation" in json_output:
              found_valid_output = True
          if any(
              token
              for token in json_output["translation"].split()
              if token in bad_tokens
          ):
              # There must be no bad tokens
              return False
      return found_valid_output
  
file_path: sockeye/test/common.py
imports: import logging
  import os
  import sys
  from contextlib import ExitStack
  from typing import Any, Dict, List
  from unittest.mock import patch
  import numpy
  import sockeye.score
  import sockeye.translate
  from sockeye import constants
  from sockeye.test_utils import run_train_translate, run_translate_restrict, TRANSLATE_PARAMS_COMMON, TRANSLATE_WITH_FACTORS_COMMON, collect_translate_output_and_scores, SCORE_PARAMS_COMMON, SCORE_WITH_SOURCE_FACTORS_COMMON, SCORE_WITH_TARGET_FACTORS_COMMON, TRANSLATE_WITH_JSON_FORMAT
label_desc: Use image node_id 4 for calling a global function with example usage: _translate_output_is_valid(translate_outputs) and returns: found_valid_output, False