code: def call_moses_detokenizer(workspace_dir: str, input_fname: str, output_fname: str, lang_code: Optional[str] = None):
      
      detokenizer_fname = os.path.join(workspace_dir,
                                       DIR_THIRD_PARTY,
                                       MOSES_DEST,
                                       "scripts",
                                       "tokenizer",
                                       "detokenizer.perl")
      with bin_open(input_fname) as inp, open(output_fname, "wb") as out, open(os.devnull, "wb") as devnull:
          command = ["perl", detokenizer_fname]
          if lang_code:
              command.append("-l")
              command.append(lang_code)
          detokenizer = subprocess.Popen(command,
                                         stdin=subprocess.PIPE,
                                         stdout=subprocess.PIPE,
                                         stderr=devnull)
          detokenizer_thread = threading.Thread(target=copy_out, args=(detokenizer.stdout, out))
          detokenizer_thread.start()
          for line in inp:
              detokenizer.stdin.write(line)
          detokenizer.stdin.close()
          detokenizer_thread.join()
          detokenizer.wait()
docs: Call Moses detokenizer.
  
      :param workspace_dir: Workspace third-party directory where Moses
                            tokenizer is checked out.
      :param input_fname: Path of tokenized input file, plain text or gzipped.
      :param output_fname: Path of tokenized output file, plain text.
      :param lang_code: Language code for rules and non-breaking prefixes.  Can be
                        None if unknown (using pre-tokenized data), which will
                        cause the tokenizer to default to English.