code: def download_pretrained_model(pretrained_model):
      """
      Download pretrained model from url.
      Args:
          pretrained_model (str): the url of pretrained weight
      Returns:
          str: the path of pretrained weight
      """
      assert urlparse(pretrained_model).netloc, "The url is not valid."
  
      pretrained_model = unquote(pretrained_model)
      savename = pretrained_model.split("/")[-1]
      if not savename.endswith(("tgz", "tar.gz", "tar", "zip")):
          savename = pretrained_model.split("/")[-2]
      else:
          savename = savename.split(".")[0]
  
      with generate_tempdir() as _dir:
          with filelock.FileLock(
              os.path.join(seg_env.TMP_HOME, savename)
          ):
              pretrained_model = download_file_and_uncompress(
                  pretrained_model,
                  savepath=_dir,
                  extrapath=seg_env.PRETRAINED_MODEL_HOME,
                  extraname=savename,
              )
              pretrained_model = os.path.join(
                  pretrained_model, "model.pdparams"
              )
      return pretrained_model
  
imports: import os
  import json
  import random
  import tempfile
  import filelock
  import contextlib
  import numpy
  import SimpleITK
  from collections.abc import Iterable
  from urllib.parse import urlparse, unquote
  from functools import partial, update_wrapper
  import paddle
  from medicalseg.utils import logger, seg_env
  from medicalseg.utils.download import download_file_and_uncompress
label_desc: Use image node_id 3 for calling a global function with example usage: download_pretrained_model(pretrained_model) and returns: pretrained_model