code: def download_song(basepath, id, name, download_url):
      # Cleanup name
      name = name.encode("ascii", "replace").decode()
      name = name.replace("?", "-")
      name = name.replace(":", "-")
      name = name.replace("(", "-")
      name = name.replace(")", "-")
      name = name.replace("'", "")
      name = name.replace(",", "-")
      name = name.replace("/", "-")
      name = name.replace("\\", "-")
      name = name.replace(".", "-")
      name = name.replace(" ", "")
  
      # Correct last `.` for filetype
      name = name[:-4] + ".wav"
  
      # Add file id to filename
      name = f"id_{id}" + "_" + name
  
      fp = os.path.join(basepath, name)
  
      # Check if file, if exists already, can be loaded by librosa
      # If it cannot be loaded, possibly corrupted file.
      # Delete and then re-download
      if os.path.exists(fp):
          try:
              _ = librosa.load(path=fp)
          except Exception:
              # File is currupted, delete and re-download.
              os.remove(fp)
  
              print(
                  f"Pre-existing file {fp} was corrupt and was deleted, will be re-downloaded."
              )
  
      if not os.path.exists(fp):
          print("Downloading file :", name)
  
          session = instantiate_session()
  
          data = None
          attempts = 10
  
          try:
              while data is None:
                  try:
                      # Get the sound data
                      data = get_resource_with_auto_refresh(
                          session, download_url
                      )
  
                  except freesound.FreesoundException as e:
                      # Most probably a rate limit or a request limit
                      # Check if that was the case, and wait appropriate amount of time
                      # for retry
                      was_resource_limited = is_resource_limited(e)
  
                      # If result of test False, it means that failure was due to some other reason.
                      # Log it, then break loop
                      if not was_resource_limited:
                          print(e)
                          break
  
                  attempts -= 1
  
                  if attempts <= 0:
                      print(
                          f"Failed to download file {fp} after 10 attempts, skipping file"
                      )
                      break
  
                  if data is None:
                      print(f"Download attempts remaining = {attempts}")
  
          finally:
              session.close()
  
          # Write the data to file
          if data is not None:
              print("Downloaded file :", name)
  
              with open(fp, "wb") as f:
                  f.write(data)
  
              # If file size is less than 89, then this probably is a text format and not an actual audio file.
              if os.path.getsize(fp) > 89:
                  print(f"File written : {fp}")
  
              else:
                  os.remove(fp)
                  print(f"File corrupted and has been deleted: {fp}")
  
          else:
              print(
                  f"File [{fp}] corrupted or faced some issue when downloading, skipped."
              )
  
          # Sleep to avoid hitting rate limits
          time.sleep(5)
  
      else:
          print(
              f"File [{fp}] already exists in dataset, skipping re-download."
          )
  
file_path: NeMo/scripts/freesound_download_resample/freesound_download.py
imports: import argparse
  import os
  import pickle
  import time
label_desc: Use image node_id 10 for calling a global function with example usage: download_song(basepath, id, name, download_url) without return types