code: def create_ms_adapt_trainer(
      method: str,
      dataset,
      feature_extractor,
      task_classifier,
      **train_params,
  ):
      """Methods for multi-source domain adaptation
  
      Args:
          method (str): Multi-source domain adaptation method, M3SDA or MFSAN
          dataset (kale.loaddata.multi_domain.MultiDomainAdapDataset): the multi-domain datasets to be used for train,
              validation, and tests.
          feature_extractor (torch.nn.Module): feature extractor network
          task_classifier (torch.nn.Module): task classifier network
  
      Returns:
          [pl.LightningModule]: Multi-source domain adaptation trainer.
      """
      method_dict = {
          "M3SDA": M3SDATrainer,
          "DIN": _DINTrainer,
          "MFSAN": MFSANTrainer,
      }
      method = method.upper()
      if method not in method_dict.keys():
          raise ValueError(
              "Unsupported multi-source domain adaptation methods %s"
              % method
          )
      else:
          return method_dict[method](
              dataset,
              feature_extractor,
              task_classifier,
              **train_params,
          )
  
imports: import torch
  import torch.nn
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.metrics.pairwise import pairwise_kernels
  from sklearn.preprocessing import LabelBinarizer
  from torch.linalg import multi_dot
  from torch.nn.functional import one_hot
  import kale.predict.losses
  from kale.embed.image_cnn import _Bottleneck
  from kale.pipeline.domain_adapter import BaseAdaptTrainer
label_desc: Use image node_id 1 for calling a global function with example usage: create_ms_adapt_trainer(method, dataset, feature_extractor, task_classifier) and returns: method_dict