docstr: Read a file into memory. Raise MediaFileStorageError if we can't.
docstr_tok: ["Read","a","file","into","memory",".","Raise","MediaFileStorageError","if","we","ca","n't","."]
code: def _read_file(self, filename: str) -> bytes:
      """Read a file into memory. Raise MediaFileStorageError if we can't."""
      try:
          with open(filename, "rb") as f:
              return f.read()
      except Exception as ex:
          raise MediaFileStorageError(
              f"Error opening '{filename}'"
          ) from ex
  
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 6 for calling the MemoryMediaFileStorage obj's underlying member method code with example usage: obj._read_file(filename) and returns: f