code: def test_artifact_add_reference_via_url(user, cleanup):
      """Test adding a reference to an artifact via a URL.
  
      This test creates three artifacts. The middle artifact references the first
      artifact's file, and the last artifact references the middle artifact's reference.
      The end result of downloading the last artifact in a fresh, forth run, should be
      that all 3 artifacts are downloaded and that the file in the last artifact is
      actually a symlink to the first artifact's file.
      """
      upstream_artifact_name = "upstream_artifact"
      middle_artifact_name = "middle_artifact"
      downstream_artifact_name = "downstream_artifact"
  
      upstream_local_path = "upstream/local/path/"
  
      upstream_artifact_path = "upstream/artifact/path/"
      middle_artifact_path = "middle/artifact/path/"
      downstream_artifact_path = "downstream/artifact/path/"
  
      upstream_local_file_path = upstream_local_path + "file.txt"
      upstream_artifact_file_path = upstream_artifact_path + "file.txt"
      middle_artifact_file_path = middle_artifact_path + "file.txt"
      downstream_artifact_file_path = (
          downstream_artifact_path + "file.txt"
      )
  
      file_text = "Luke, I am your Father!!!!!"
      # Create a super important file
      if not os.path.exists(upstream_local_path):
          os.makedirs(upstream_local_path)
      with open(upstream_local_file_path, "w") as file:
          file.write(file_text)
  
      # Create an artifact with such file stored
      with wandb.init() as run:
          artifact = wandb.Artifact(upstream_artifact_name, "database")
          artifact.add_file(
              upstream_local_file_path, upstream_artifact_file_path
          )
          run.log_artifact(artifact)
  
      # Create an middle artifact with such file referenced (notice no need to download)
      with wandb.init() as run:
          artifact = wandb.Artifact(middle_artifact_name, "database")
          upstream_artifact = run.use_artifact(
              upstream_artifact_name + ":latest"
          )
          artifact.add_reference(
              f"wandb-artifact://{_b64_to_hex_id(upstream_artifact.id)}/{str(upstream_artifact_file_path)}",
              middle_artifact_file_path,
          )
          run.log_artifact(artifact)
  
      # Create a downstream artifact that is referencing the middle's reference
      with wandb.init() as run:
          artifact = wandb.Artifact(
              downstream_artifact_name, "database"
          )
          middle_artifact = run.use_artifact(
              middle_artifact_name + ":latest"
          )
          artifact.add_reference(
              f"wandb-artifact://{_b64_to_hex_id(middle_artifact.id)}/{str(middle_artifact_file_path)}",
              downstream_artifact_file_path,
          )
          run.log_artifact(artifact)
  
      # Remove the directories for good measure
      if os.path.isdir("upstream"):
          shutil.rmtree("upstream")
      if os.path.isdir("artifacts"):
          shutil.rmtree("artifacts")
  
      # Finally, use the artifact (download it) and enforce that the file is where we want it!
      with wandb.init() as run:
          downstream_artifact = run.use_artifact(
              downstream_artifact_name + ":latest"
          )
          downstream_path = downstream_artifact.download()
          with open(
              os.path.join(
                  downstream_path, downstream_artifact_file_path
              )
          ) as file:
              assert file.read() == file_text
  
imports: import base64
  import binascii
  import os
  import shutil
  import time
  from math import cos, pi, sin
  import boto3
  import botocore
  import google.cloud.storage
  import numpy
  import pytest
  import wandb
  from bokeh.plotting import figure
  from wandb.sdk.artifacts.storage_handlers.gcs_handler import GCSHandler
  from wandb.sdk.artifacts.storage_handlers.s3_handler import S3Handler
label_desc: Use image node_id 10 for calling a global function with example usage: test_artifact_add_reference_via_url(user, cleanup) without return types