code: def get_pretrained_resnet_medicalnet(
      resnet_depth: int, device: str = "cpu", datasets23: bool = True
  ):
      """
      Donwlad resnet pretrained weights from https://huggingface.co/TencentMedicalNet
  
      Args:
          resnet_depth: depth of the pretrained model. Supported values are 10, 18, 34, 50, 101, 152 and 200
          device: device on which the returned state dict will be loaded. "cpu" or "cuda" for example.
          datasets23: if True, get the weights trained on more datasets (23).
                      Not all depths are available. If not, standard weights are returned.
  
      Returns:
          Pretrained state dict
  
      Raises:
          huggingface_hub.utils._errors.EntryNotFoundError: if pretrained weights are not found on huggingface hub
          NotImplementedError: if `resnet_depth` is not supported
      """
  
      medicalnet_huggingface_repo_basename = (
          "TencentMedicalNet/MedicalNet-Resnet"
      )
      medicalnet_huggingface_files_basename = "resnet_"
      supported_depth = [10, 18, 34, 50, 101, 152, 200]
  
      logger.info(
          f"Loading MedicalNet pretrained model from https://huggingface.co/{medicalnet_huggingface_repo_basename}{resnet_depth}"
      )
  
      if resnet_depth in supported_depth:
          filename = (
              f"{medicalnet_huggingface_files_basename}{resnet_depth}.pth"
              if not datasets23
              else f"{medicalnet_huggingface_files_basename}{resnet_depth}_23dataset.pth"
          )
          try:
              pretrained_path = hf_hub_download(
                  repo_id=f"{medicalnet_huggingface_repo_basename}{resnet_depth}",
                  filename=filename,
              )
          except Exception:
              if datasets23:
                  logger.info(
                      f"{filename} not available for resnet{resnet_depth}"
                  )
                  filename = f"{medicalnet_huggingface_files_basename}{resnet_depth}.pth"
                  logger.info(f"Trying with {filename}")
                  pretrained_path = hf_hub_download(
                      repo_id=f"{medicalnet_huggingface_repo_basename}{resnet_depth}",
                      filename=filename,
                  )
              else:
                  raise EntryNotFoundError(
                      f"{filename} not found on {medicalnet_huggingface_repo_basename}{resnet_depth}"
                  ) from None
          checkpoint = torch.load(
              pretrained_path, map_location=torch.device(device)
          )
      else:
          raise NotImplementedError(
              "Supported resnet_depth are: [10, 18, 34, 50, 101, 152, 200]"
          )
      logger.info(f"{filename} downloaded")
      return checkpoint.get("state_dict")
  
imports: from __future__ import annotations
  import logging
  import re
  from collections.abc import Callable
  from functools import partial
  from pathlib import Path
  from typing import Any
  import torch
  import torch.nn
  from monai.networks.layers.factories import Conv, Norm, Pool
  from monai.networks.layers.utils import get_pool_layer
  from monai.utils import ensure_tuple_rep
  from monai.utils.module import look_up_option, optional_import
label_desc: Use image node_id 11 for calling a global function with example usage: get_pretrained_resnet_medicalnet(resnet_depth, device, datasets23) and returns: checkpoint