code: def detect_languages(pages, valid_languages):
      """Predicts page language using cld3 and adds to features."""
  
      beam = tfds.core.lazy_imports.apache_beam
  
      class _PredictLanguageFn(beam.DoFn):
          """Predicts page's language using cld3 and adds to features."""
  
          def __init__(self, valid_languages, min_probability=0.95):
              self._valid_languages = set(valid_languages)
              self._counter_inc_fn = get_counter_inc_fn(
                  "language-filter"
              )
              self._min_probability = min_probability
  
          def start_bundle(self):
              with langdetect_lock:
                  self._detector = tfds.core.lazy_imports.gcld3.NNetLanguageIdentifier(
                      # CLD3 is not expected to work well on very short documents.
                      min_num_bytes=100,
                      max_num_bytes=10000,
                  )
  
          def process(self, page: PageFeatures):
              with langdetect_lock:
                  result = self._detector.FindLanguage(page.text)
              if not result.is_reliable:
                  self._counter_inc_fn("filtered:no_predictions")
                  lang = UNKNOWN_LANGUAGE
              elif result.probability < self._min_probability:
                  self._counter_inc_fn("filtered:low_confidence")
                  lang = UNKNOWN_LANGUAGE
              else:
                  lang = result.language
                  if lang not in self._valid_languages:
                      self._counter_inc_fn("filtered:ignored_language")
                      return
              self._counter_inc_fn("passed")
              self._counter_inc_fn("passed:%s" % lang)
              yield dataclasses.replace(page, language=lang)
  
      return pages | beam.ParDo(
          _PredictLanguageFn(valid_languages=valid_languages)
      )
  
imports: import dataclasses
  import functools
  import gzip
  import hashlib
  import heapq
  import io
  import re
  import threading
  from typing import Collection, Iterable, Mapping, Optional, Sequence, Tuple
  from absl import logging
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 6 for calling a global function with example usage: detect_languages(pages, valid_languages) and returns: unknown