code: def url_to_filename(url: str, etag: str = None) -> str:
      """
      Convert `url` into a hashed filename in a repeatable way.
      If `etag` is specified, append its hash to the url's, delimited
      by a period.
      """
      if url.split("/")[-1].endswith("zip"):
          url_bytes = url.encode("utf-8")
          url_hash = sha256(url_bytes)
          filename = url_hash.hexdigest()
          if etag:
              etag_bytes = etag.encode("utf-8")
              etag_hash = sha256(etag_bytes)
              filename += "." + etag_hash.hexdigest()
      else:
          filename = url.split("/")[-1]
  
      return filename
  
file_path: nlp-architect/nlp_architect/utils/file_cache.py
imports: import os
  import logging
  import shutil
  import tempfile
  import json
  from urllib.parse import urlparse
  from pathlib import Path
  from typing import Tuple, Union, IO
  from hashlib import sha256
  from nlp_architect import LIBRARY_OUT
  from nlp_architect.utils.io import load_json_file
  import requests
label_desc: Use image node_id 2 for calling a global function with example usage: url_to_filename(url, etag) and returns: filename