code: def test_get_number_of_sanic_workers(
      env_value: Optional[Text],
      lock_store: Union[LockStore, Text, None],
      expected: Optional[int],
  ):
      # remember pre-test value of SANIC_WORKERS env var
      pre_test_value = os.environ.get(ENV_SANIC_WORKERS)
  
      # set env var to desired value and make assertion
      if env_value is not None:
          os.environ[ENV_SANIC_WORKERS] = str(env_value)
  
      # lock_store may be string or LockStore object
      # create EndpointConfig if it's a string, otherwise pass the object
      if isinstance(lock_store, str):
          lock_store = EndpointConfig(type=lock_store)
  
      assert utils.number_of_sanic_workers(lock_store) == expected
  
      # reset env var to pre-test value
      os.environ.pop(ENV_SANIC_WORKERS, None)
  
      if pre_test_value is not None:
          os.environ[ENV_SANIC_WORKERS] = pre_test_value
  
imports: import os
  from decimal import Decimal
  from typing import Optional, Text, Union, Any
  from pathlib import Path
  import pytest
  import rasa.core.lock_store
  import rasa.utils.io
  from rasa.constants import ENV_SANIC_WORKERS
  from rasa.core import utils
  from rasa.core.lock_store import LockStore, RedisLockStore, InMemoryLockStore
  from rasa.core.policies.policy import PolicyPrediction
  from rasa.shared.core.domain import Domain
  from rasa.utils.endpoints import EndpointConfig
  from tests.conftest import write_endpoint_config_to_yaml
label_desc: Use image node_id 5 for calling a global function with example usage: test_get_number_of_sanic_workers(env_value, lock_store, expected) without return types