code: def create_component(
      component_type: ComponentType, config: Any, *args, **kwargs
  ):
      config_cls = type(config)
      cls = Registry.get(component_type, config_cls)
      try:
          return cls.from_config(config, *args, **kwargs)
      except TypeError as e:
          raise Exception(f"Can't create component {cls}: {str(e)}")
  
imports: import collections
  import enum
  from typing import Any, Dict, List, Tuple, Type, Union
  import torch
  from pytext.utils.usage import log_class_usage
  from .pytext_config import ConfigBase, PyTextConfig
label_desc: Use image node_id 2 for calling a global function with example usage: create_component(component_type, config) and returns: cls