code: def _remap_standard_resnet_model(
      model_url: str, state_dict_key: str | None = None
  ):
      pattern_conv0 = re.compile(r"^conv1\.(.+)$")
      pattern_bn1 = re.compile(r"^bn1\.(.+)$")
      pattern_block = re.compile(r"^layer(\d+)\.(\d+)\.(.+)$")
      # bn3 to next denselayer's preact/bn
      pattern_block_bn3 = re.compile(
          r"^(res_blocks.d\d+\.layers\.denselayer_)(\d+)\.layers\.bn3\.(.+)$"
      )
      # bn1, bn2 to conv1/bn, conv2/bn
      pattern_block_bn = re.compile(
          r"^(res_blocks.d\d+\.layers\.denselayer_\d+\.layers)\.bn(\d+)\.(.+)$"
      )
      pattern_downsample0 = re.compile(
          r"^(res_blocks.d\d+).+\.downsample\.0\.(.+)"
      )
      pattern_downsample1 = re.compile(
          r"^(res_blocks.d\d+).+\.downsample\.1\.(.+)"
      )
      # download the pretrained weights into torch hub's default dir
      weights_dir = os.path.join(torch.hub.get_dir(), "resnet50.pth")
      download_url(
          model_url, fuzzy=True, filepath=weights_dir, progress=False
      )
      state_dict = torch.load(
          weights_dir,
          map_location=None
          if torch.cuda.is_available()
          else torch.device("cpu"),
      )
      if state_dict_key is not None:
          state_dict = state_dict[state_dict_key]
  
      for key in list(state_dict.keys()):
          new_key = None
          if pattern_conv0.match(key):
              new_key = re.sub(pattern_conv0, r"conv0.conv.\1", key)
          elif pattern_bn1.match(key):
              new_key = re.sub(pattern_bn1, r"conv0.bn.\1", key)
          elif pattern_block.match(key):
              new_key = re.sub(
                  pattern_block,
                  lambda s: "res_blocks.d"
                  + str(int(s.group(1)) - 1)
                  + ".layers.denselayer_"
                  + s.group(2)
                  + ".layers."
                  + s.group(3),
                  key,
              )
              if pattern_block_bn3.match(new_key):
                  new_key = re.sub(
                      pattern_block_bn3,
                      lambda s: s.group(1)
                      + str(int(s.group(2)) + 1)
                      + ".layers.preact/bn."
                      + s.group(3),
                      new_key,
                  )
              elif pattern_block_bn.match(new_key):
                  new_key = re.sub(
                      pattern_block_bn, r"\1.conv\2/bn.\3", new_key
                  )
              elif pattern_downsample0.match(new_key):
                  new_key = re.sub(
                      pattern_downsample0, r"\1.shortcut.\2", new_key
                  )
              elif pattern_downsample1.match(new_key):
                  new_key = re.sub(
                      pattern_downsample1,
                      r"\1.bna_block.bn.\2",
                      new_key,
                  )
          if new_key:
              state_dict[new_key] = state_dict[key]
              del state_dict[key]
  
      return state_dict
  
imports: from __future__ import annotations
  import os
  import re
  import warnings
  from collections import OrderedDict
  from collections.abc import Callable, Sequence
  import torch
  import torch.nn
  from monai.apps.utils import download_url
  from monai.networks.blocks import UpSample
  from monai.networks.layers.factories import Conv, Dropout
  from monai.networks.layers.utils import get_act_layer, get_norm_layer
  from monai.utils.enums import HoVerNetBranch, HoVerNetMode, InterpolateMode, UpsampleMode
  from monai.utils.module import export, look_up_option
label_desc: Use image node_id 3 for calling a global function with example usage: _remap_standard_resnet_model(model_url, state_dict_key) and returns: state_dict