code: def add_to_collection(
      name: Text, config: de_config_pb2.DynamicEmbeddingConfig
  ):
      """Adds given (name, config) pair to global collectionss.
  
      Args:
        name: A string denoting the variable name.
        config: An instance of DynamicEmbeddingConfig.
  
      Raises:
        TypeError: Invalid input.
        ValueError: Name is empty, or a different config is added for an existing
        variable.
      """
      if not name:
          raise ValueError("Empty name.")
      if not isinstance(config, de_config_pb2.DynamicEmbeddingConfig):
          raise TypeError(
              "Config is not an instance of DynamicEmbeddingConfig."
          )
      if name in _knowledge_bank_collections.keys():
          existing_config = _knowledge_bank_collections[name]
          if (
              config.SerializeToString()
              != existing_config.SerializeToString()
          ):
              raise ValueError(
                  "Adding a new config for the same var name is not allowed, existing:"
                  " %r, new: %r." % (existing_config, config)
              )
  
      with _lock:
          _knowledge_bank_collections[
              name
          ] = de_config_pb2.DynamicEmbeddingConfig()
          _knowledge_bank_collections[name].CopyFrom(config)
  
imports: import threading
  from typing import Text
  from research.carls import dynamic_embedding_config_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: add_to_collection(name, config) without return types