code: def get_model(cfg, dataset, num_channels):
      """
      Builds and returns a model and associated hyper-parameters according to the config object passed.
  
      Args:
          cfg: A YACS config object.
          dataset: A multidomain dataset consisting of source and target datasets.
          num_channels: The number of image channels.
      """
      config_params = get_config(cfg)
      train_params = config_params["train_params"]
      train_params_local = deepcopy(train_params)
  
      # setup feature extractor
      if cfg.DATASET.NAME.upper() == "DIGITS":
          feature_network = SmallCNNFeature(num_channels)
      else:
          feature_network = ResNet18Feature()
  
      if cfg.DAN.METHOD == "MFSAN":
          feature_network = torch.nn.Sequential(
              *(list(feature_network.children())[:-1])
          )
  
      method_params = {
          "n_classes": cfg.DATASET.NUM_CLASSES,
          "target_domain": cfg.DATASET.TARGET,
      }
  
      model = create_ms_adapt_trainer(
          method=cfg.DAN.METHOD,
          dataset=dataset,
          feature_extractor=feature_network,
          task_classifier=ClassNetSmallImage,
          **method_params,
          **train_params_local,
      )
  
      return model, train_params
  
imports: from copy import deepcopy
  import torch
  from kale.embed.image_cnn import ResNet18Feature, SmallCNNFeature
  from kale.pipeline.multi_domain_adapter import create_ms_adapt_trainer
  from kale.predict.class_domain_nets import ClassNetSmallImage
label_desc: Use image node_id 2 for calling a global function with example usage: get_model(cfg, dataset, num_channels) and returns: model,  train_params