code: def find_wordvec_pretrain(
      language,
      default_pretrains,
      dataset_pretrains=None,
      dataset=None,
      model_dir=DEFAULT_MODEL_DIR,
  ):
      # try to get the default pretrain for the language,
      # but allow the package specific value to override it if that is set
      default_pt = default_pretrains.get(language, None)
      if dataset is not None and dataset_pretrains is not None:
          default_pt = dataset_pretrains.get(language, {}).get(
              dataset, default_pt
          )
  
      if default_pt is not None:
          default_pt_path = "{}/{}/pretrain/{}.pt".format(
              model_dir, language, default_pt
          )
          if not os.path.exists(default_pt_path):
              logger.info(
                  "Default pretrain should be {}  Attempting to download".format(
                      default_pt_path
                  )
              )
              try:
                  download(
                      lang=language,
                      package=None,
                      processors={"pretrain": default_pt},
                      model_dir=model_dir,
                  )
              except UnknownLanguageError:
                  # if there's a pretrain in the directory, hiding this
                  # error will let us find that pretrain later
                  pass
          if os.path.exists(default_pt_path):
              if (
                  dataset is not None
                  and dataset_pretrains is not None
                  and language in dataset_pretrains
                  and dataset in dataset_pretrains[language]
              ):
                  logger.info(
                      f"Using default pretrain for {language}:{dataset}, found in {default_pt_path}  To use a different pretrain, specify --wordvec_pretrain_file"
                  )
              else:
                  logger.info(
                      f"Using default pretrain for language, found in {default_pt_path}  To use a different pretrain, specify --wordvec_pretrain_file"
                  )
              return default_pt_path
  
      pretrain_path = "{}/{}/pretrain/*.pt".format(model_dir, language)
      pretrains = glob.glob(pretrain_path)
      if len(pretrains) == 0:
          # we already tried to download the default pretrain once
          # and it didn't work.  maybe the default language package
          # will have something?
          logger.warning(
              f"Cannot figure out which pretrain to use for '{language}'.  Will download the default package and hope for the best"
          )
          try:
              download(lang=language, model_dir=model_dir)
          except UnknownLanguageError as e:
              # this is a very unusual situation
              # basically, there was a language which we started to add
              # to the resources, but then didn't release the models
              # as part of resources.json
              raise FileNotFoundError(
                  f"Cannot find any pretrains in {pretrain_path}  No pretrains in the system for this language.  Please prepare an embedding as a .pt and use --wordvec_pretrain_file to specify a .pt file to use"
              ) from e
          pretrains = glob.glob(pretrain_path)
      if len(pretrains) == 0:
          raise FileNotFoundError(
              f"Cannot find any pretrains in {pretrain_path}  Try 'stanza.download(\"{language}\")' to get a default pretrain or use --wordvec_pretrain_file to specify a .pt file to use"
          )
      if len(pretrains) > 1:
          raise FileNotFoundError(
              f"Too many pretrains to choose from in {pretrain_path}  Must specify an exact path to a --wordvec_pretrain_file"
          )
      pt = pretrains[0]
      logger.info(
          f"Using pretrain found in {pt}  To use a different pretrain, specify --wordvec_pretrain_file"
      )
      return pt
  
imports: import argparse
  import glob
  import logging
  import os
  import pathlib
  import sys
  import tempfile
  from enum import Enum
  from stanza.resources.default_packages import default_charlms, lemma_charlms, pos_charlms, depparse_charlms, TRANSFORMERS, TRANSFORMER_LAYERS
  from stanza.models.common.constant import treebank_to_short_name
  from stanza.models.common.utils import ud_scores
  from stanza.resources.common import download, DEFAULT_MODEL_DIR, UnknownLanguageError
  from stanza.utils.datasets import common
  import stanza.utils.default_paths
  from stanza.utils import conll18_ud_eval
label_desc: Use image node_id 9 for calling a global function with example usage: find_wordvec_pretrain(language, default_pretrains, dataset_pretrains, dataset, model_dir) and returns: pt, default_pt_path