code: def get_spacy_model(
      spacy_model_name: str,
      pos_tags: bool = True,
      parse: bool = False,
      ner: bool = False,
  ) -> SpacyModelType:
      """
      In order to avoid loading spacy models a whole bunch of times, we'll save references to them,
      keyed by the options we used to create the spacy model, so any particular configuration only
      gets loaded once.
      """
  
      options = (spacy_model_name, pos_tags, parse, ner)
      if options not in LOADED_SPACY_MODELS:
          disable = ["vectors", "textcat"]
          if not pos_tags:
              disable.append("tagger")
          if not parse:
              disable.append("parser")
          if not ner:
              disable.append("ner")
          try:
              spacy_model = spacy.load(
                  spacy_model_name, disable=disable
              )
          except OSError:
              logger.warning(
                  f"Spacy models '{spacy_model_name}' not found.  Downloading and installing."
              )
              spacy_download(spacy_model_name)
  
              # Import the downloaded model module directly and load from there
              spacy_model_module = __import__(spacy_model_name)
              spacy_model = spacy_model_module.load(disable=disable)  # type: ignore
  
          LOADED_SPACY_MODELS[options] = spacy_model
      return LOADED_SPACY_MODELS[options]
  
imports: import hashlib
  import io
  from datetime import timedelta
  import importlib
  import json
  import logging
  import os
  import pkgutil
  import random
  import sys
  import signal
  from contextlib import contextmanager
  from itertools import islice, zip_longest
  from pathlib import Path
  from typing import Any, Callable, Dict, Generator, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union, Sequence, Set
  import dill
  import numpy
  import spacy
  import torch
  import torch.distributed
  from spacy.cli.download import download
  from spacy.language import Language
  import base58
  from allennlp.common.checks import log_pytorch_version_info
  from allennlp.common.params import Params
label_desc: Use image node_id 8 for calling a global function with example usage: get_spacy_model(spacy_model_name, pos_tags, parse, ner) and returns: LOADED_SPACY_MODELS