code: def check_latin1(sentence: str) -> bool:
      """Check whether the sentence can be encoded in latin1
  
      This is used in
      https://github.com/mlperf/training/blob/master/rnn_translator/pytorch/scripts/filter_dataset.py
  
      The idea is to filter the sentences with rare unicode glyphs
  
      Returns
      -------
      ret
          Whether sentences are latin1
      """
      try:
          sentence.encode("latin1")
      except UnicodeEncodeError:
          return False
      else:
          return True
  
imports: import argparse
  import os
  import multiprocessing
  import time
  import numpy
  import warnings
  import re
  from gluonnlp.data.filtering import MosesNormalizer
  from gluonnlp.data.tokenizers import MosesTokenizer, BaseTokenizer, WhitespaceTokenizer, JiebaTokenizer
  from typing import List, Union, Optional
label_desc: Use image node_id 3 for calling a global function with example usage: check_latin1(sentence) and returns: True, False