code: def _filesystem() -> AbstractFileSystem:
      fs = LocalFileSystem()
  
      endpoint_url = os.getenv("LIGHTNING_BUCKET_ENDPOINT_URL", "")
      bucket_name = os.getenv("LIGHTNING_BUCKET_NAME", "")
      if endpoint_url != "" and bucket_name != "":
          # FIXME: Temporary fix until we remove the injection from the platform
          if "AWS_ACCESS_KEY_ID" in os.environ:
              del os.environ["AWS_ACCESS_KEY_ID"]
              del os.environ["AWS_SECRET_ACCESS_KEY"]
  
          fs = S3FileSystem()
  
          app_id = os.getenv("LIGHTNING_CLOUD_APP_ID", "")
          if app_id == "":
              raise RuntimeError("missing LIGHTNING_CLOUD_APP_ID")
  
          if not fs.exists(_shared_storage_path()):
              raise RuntimeError(
                  f"shared filesystem {_shared_storage_path()} does not exist"
              )
  
      return fs
  
imports: import hashlib
  import os
  import pathlib
  import shutil
  import sys
  from time import sleep
  from typing import TYPE_CHECKING, Any, List, Optional, Sequence, Union
  from fsspec import AbstractFileSystem
  from fsspec.implementations.local import LocalFileSystem
  from lightning.app.core.constants import REMOTE_STORAGE_WAIT
  from lightning.app.core.queues import BaseQueue
  from lightning.app.storage.requests import _ExistsRequest, _ExistsResponse, _GetRequest, _GetResponse
  from lightning.app.utilities.app_helpers import Logger
  from lightning.app.utilities.component import _is_flow_context
  from lightning.app.utilities.imports import _is_s3fs_available
label_desc: Use image node_id 7 for calling a global function with example usage: _filesystem() and returns: fs