code: def _create_from_endpoint_config(
      endpoint_config: Optional[EndpointConfig] = None,
  ) -> LockStore:
      """Given an endpoint configuration, create a proper `LockStore` object."""
      if (
          endpoint_config is None
          or endpoint_config.type is None
          or endpoint_config.type == "in_memory"
      ):
          # this is the default type if no lock store type is set
  
          lock_store: LockStore = InMemoryLockStore()
      elif endpoint_config.type == "redis":
          lock_store = RedisLockStore(
              host=endpoint_config.url, **endpoint_config.kwargs
          )
      else:
          lock_store = _load_from_module_name_in_endpoint_config(
              endpoint_config
          )
  
      logger.debug(
          f"Connected to lock store '{lock_store.__class__.__name__}'."
      )
  
      return lock_store
  
imports: from __future__ import annotations
  import asyncio
  from contextlib import asynccontextmanager
  import json
  import logging
  import os
  from typing import AsyncGenerator, Dict, Optional, Text, Union
  from rasa.shared.exceptions import RasaException, ConnectionException
  import rasa.shared.utils.common
  from rasa.core.constants import DEFAULT_LOCK_LIFETIME
  from rasa.core.lock import TicketLock
  from rasa.utils.endpoints import EndpointConfig
label_desc: Use image node_id 2 for calling a global function with example usage: _create_from_endpoint_config(endpoint_config) and returns: lock_store