code: def swappable(**kwargs) -> Callable[[Type[C]], Type[C]]:
      """
      Decorator that adds swappable subcomponents to a class.
  
      Usage:
  
      ```python
      @swappable(component_name=DefaultComponentClass, ...)
      ```
      """
  
      # Decorators need to return callables that accept only the decorated object.
      # To comply, bundle kwargs into a function that accepts only one argument.
      def wrap(cls: Type[C]) -> Type[C]:
          return _make_class_swappable(cls, **kwargs)
  
      return wrap
  
file_path: ParlAI/parlai/agents/transformer/modules/modular.py
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import Any, Callable, Dict, Generic, Optional, Type, TypeVar
label_desc: Use image node_id 1 for calling a global function with example usage: swappable() and returns: wrap, _make_class_swappable