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]
          filename = pretrained_model.split("/")[-1]
      else:
          savename = savename.split(".")[0]
          filename = "model.pdparams"
  
      with generate_tempdir() as _dir:
          pretrained_model = download_file_and_uncompress(
              pretrained_model,
              savepath=_dir,
              cover=False,
              extrapath=seg_env.PRETRAINED_MODEL_HOME,
              extraname=savename,
              filename=filename,
          )
          pretrained_model = os.path.join(pretrained_model, filename)
      return pretrained_model
  
imports: import os
  import contextlib
  import tempfile
  import random
  from urllib.parse import urlparse, unquote
  import yaml
  import numpy
  import paddle
  import cv2
  from paddleseg.utils import logger, seg_env, get_sys_env
  from paddleseg.utils.download import download_file_and_uncompress
label_desc: Use image node_id 9 for calling a global function with example usage: download_pretrained_model(pretrained_model) and returns: pretrained_model