code: def filename_fom_url(url: str, etag: Optional[str] = None) -> str:
      """Converts a URL, and optional etag, to a filename using a SHA 256 hash."""
      url_as_bytes = url.encode("utf-8")
      filename = hashlib.sha256(url_as_bytes).hexdigest()[:16]
  
      if etag:
          etag_bytes = etag.encode("utf-8")
          etag_sha = hashlib.sha256(etag_bytes).hexdigest()[:8]
          filename += f"_{etag_sha}"
  
      # Preserve file extension for URLs that include it.
      parsed_url = urllib_parse.urlparse(url)
      url_path = parsed_url.path
      _, extension = os.path.splitext(url_path)
      if extension:
          filename += extension
  
      return filename
  
imports: from collections.abc import Mapping
  import functools
  import hashlib
  import os
  import shutil
  import sys
  import tarfile
  import tempfile
  from typing import BinaryIO, Optional
  from urllib import parse
  import zipfile
  from absl import logging
  import filelock
  import requests
  import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: filename_fom_url(url, etag) and returns: filename