code: def get_extension_for_mimetype(mimetype: str) -> str:
      if mimetype in PREFERRED_MIMETYPE_EXTENSION_MAP:
          return PREFERRED_MIMETYPE_EXTENSION_MAP[mimetype]
  
      extension = mimetypes.guess_extension(mimetype, strict=False)
      if extension is None:
          return ""
  
      return extension
  
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 2 for calling a global function with example usage: get_extension_for_mimetype(mimetype) and returns: extension, PREFERRED_MIMETYPE_EXTENSION_MAP, str