code: def resolve_retriever(
      document_store, retriever_class: Optional[str] = None
  ) -> Optional[Any]:
      """
      Resolves the retriever class to use for the given document store.
      :param document_store: The document store to use.
      :param retriever_class: The retriever class to use. If not given, it will be inferred from the document store.
      """
      # first match the document store to the retriever
      # TODO: add more retrievers
      embedding_retriever_map = {
          InMemoryDocumentStore: InMemoryEmbeddingRetriever
      }
  
      retriever_clazz = (
          retriever_class
          or embedding_retriever_map[type(document_store)]
          if type(document_store) in embedding_retriever_map
          else None
      )
      if not retriever_clazz:
          raise ValueError(
              f"Document store {type(document_store)} is not supported. Please provide a retriever class or use "
              f"one of the following document stores: {list(embedding_retriever_map.keys())}"
          )
  
      retriever = retriever_clazz(document_store=document_store)  # type: ignore
      return retriever
  
imports: import re
  from abc import ABC, abstractmethod
  from typing import Optional, Any
  from huggingface_hub import HfApi
  from haystack import Pipeline
  from haystack.components.builders.answer_builder import AnswerBuilder
  from haystack.components.builders.prompt_builder import PromptBuilder
  from haystack.components.embedders import SentenceTransformersTextEmbedder
  from haystack.components.generators import OpenAIGenerator, HuggingFaceTGIGenerator
  from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
  from haystack.dataclasses import Answer
  from haystack.document_stores.types import DocumentStore
  from haystack.document_stores.in_memory import InMemoryDocumentStore
label_desc: Use image node_id 3 for calling a global function with example usage: resolve_retriever(document_store, retriever_class) and returns: retriever