code: def densenet(dataset: str, depth: int, pretrained=False) -> Module:
      """
      Wrapper for densenet available in the pytorchcv package.
  
      :param dataset: One of cifar10, cifar100, svhn, imagenet.
      :param depth: The depth of the densnet. For imagenet depths
                    (121, 161, 169, 201) are supported. The other datasets
                     support dephts (40, 100).
      :param pretrained: load model pretrained on `dataset`..
      """
      if dataset in ["cifar10", "cifar100", "svhn"]:
          available_depths = [40, 100]
          # other growth rates are available through the general method.
          growth_rate = 12
          model_name = f"densenet{depth}_k{growth_rate}_{dataset}"
      elif dataset == "imagenet":
          available_depths = [121, 161, 169, 201]
          model_name = f"densenet{depth}"
      else:
          raise ValueError(f"Unrecognized dataset {dataset}")
  
      if depth not in available_depths:
          raise ValueError(
              f"Depth {depth} not available for dataset {dataset}, "
              f"availble depths are {available_depths}"
          )
  
      model = ptcv_get_model(model_name, pretrained=pretrained)
      return model
  
imports: from pytorchcv.model_provider import get_model
  from torch.nn import Module
label_desc: Use image node_id 3 for calling a global function with example usage: densenet(dataset, depth, pretrained) and returns: model