code: def _calculate_file_id(
      data: bytes, mimetype: str, filename: Optional[str] = None
  ) -> str:
      """Hash data, mimetype, and an optional filename to generate a stable file ID.
  
      Parameters
      ----------
      data
          Content of in-memory file in bytes. Other types will throw TypeError.
      mimetype
          Any string. Will be converted to bytes and used to compute a hash.
      filename
          Any string. Will be converted to bytes and used to compute a hash.
      """
      filehash = hashlib.new("sha224", **HASHLIB_KWARGS)
      filehash.update(data)
      filehash.update(bytes(mimetype.encode()))
  
      if filename is not None:
          filehash.update(bytes(filename.encode()))
  
      return filehash.hexdigest()
  
imports: import contextlib
  import hashlib
  import mimetypes
  import os.path
  from typing import Dict, List, NamedTuple, Optional, Union
  from typing_extensions import Final
  from streamlit.logger import get_logger
  from streamlit.runtime.media_file_storage import MediaFileKind, MediaFileStorage, MediaFileStorageError
  from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
  from streamlit.util import HASHLIB_KWARGS
label_desc: Use image node_id 1 for calling a global function with example usage: _calculate_file_id(data, mimetype, filename) and returns: filehash