code: def create_test_sharder(
      sharder_type: str,
      sharding_type: str,
      kernel_type: str,
      fused_params: Optional[Dict[str, Any]] = None,
      qcomms_config: Optional[QCommsConfig] = None,
      device: Optional[torch.device] = None,
  ) -> Union[
      TestEBSharder, TestEBCSharder, TestETSharder, TestETCSharder
  ]:
      if fused_params is None:
          fused_params = {}
      qcomm_codecs_registry = {}
      if qcomms_config is not None:
          qcomm_codecs_registry = get_qcomm_codecs_registry(
              qcomms_config, device=device
          )
      if "learning_rate" not in fused_params:
          fused_params["learning_rate"] = 0.1
      if sharder_type == SharderType.EMBEDDING_BAG.value:
          return TestEBSharder(
              sharding_type,
              kernel_type,
              fused_params,
              qcomm_codecs_registry,
          )
      elif sharder_type == SharderType.EMBEDDING_BAG_COLLECTION.value:
          return TestEBCSharder(
              sharding_type,
              kernel_type,
              fused_params,
              qcomm_codecs_registry,
          )
      elif sharder_type == SharderType.EMBEDDING_TOWER.value:
          return TestETSharder(
              sharding_type,
              kernel_type,
              fused_params,
              qcomm_codecs_registry,
          )
      elif sharder_type == SharderType.EMBEDDING_TOWER_COLLECTION.value:
          return TestETCSharder(
              sharding_type,
              kernel_type,
              fused_params,
              qcomm_codecs_registry,
          )
      else:
          raise ValueError(f"Sharder not supported {sharder_type}")
  
imports: from enum import Enum
  from typing import Any, cast, Dict, List, Optional, Protocol, Tuple, Type, Union
  import torch
  import torch.distributed
  import torch.nn
  from fbgemm_gpu.split_embedding_configs import EmbOptimType
  from torch.distributed.optim import _apply_optimizer_in_backward
  from torchrec.distributed.embedding_types import EmbeddingTableConfig
  from torchrec.distributed.fbgemm_qcomm_codec import CommType, get_qcomm_codecs_registry, QCommsConfig
  from torchrec.distributed.model_parallel import DistributedModelParallel
  from torchrec.distributed.planner import EmbeddingShardingPlanner, ParameterConstraints, Topology
  from torchrec.distributed.test_utils.multi_process import MultiProcessContext
  from torchrec.distributed.test_utils.test_model import ModelInput, TestEBCSharder, TestEBSharder, TestETCSharder, TestETSharder, TestSparseNNBase
  from torchrec.distributed.types import EmbeddingModuleShardingPlan, ModuleSharder, ShardedTensor, ShardingEnv, ShardingPlan, ShardingType
  from torchrec.modules.embedding_configs import BaseEmbeddingConfig, EmbeddingBagConfig
  from torchrec.optim.keyed import CombinedOptimizer, KeyedOptimizerWrapper
  from torchrec.optim.optimizers import in_backward_optimizer_filter
label_desc: Use image node_id 1 for calling a global function with example usage: create_test_sharder(sharder_type, sharding_type, kernel_type, fused_params, qcomms_config, device) and returns: TestEBSharder, TestEBCSharder, TestETSharder, TestETCSharder