code: def _is_dir(
      fs: AbstractFileSystem,
      path: Union[str, Path],
      strict: bool = False,
  ) -> bool:
      """Check if a path is directory-like.
  
      This function determines if a given path is considered directory-like, taking into account the behavior
      specific to object storage platforms. For other filesystems, it behaves similarly to the standard `fs.isdir`
      method.
  
      Args:
          fs: The filesystem to check the path against.
          path: The path or URL to be checked.
          strict: A flag specific to Object Storage platforms. If set to ``False``, any non-existing path is considered
              as a valid directory-like path. In such cases, the directory (and any non-existing parent directories)
              will be created on the fly. Defaults to False.
  
      """
      # Object storage fsspec's are inconsistent with other file systems because they do not have real directories,
      # see for instance https://gcsfs.readthedocs.io/en/latest/api.html?highlight=makedirs#gcsfs.core.GCSFileSystem.mkdir
      # In particular, `fs.makedirs` is a no-op so we use `strict=False` to consider any path as valid, except if the
      # path already exists but is a file
      if _is_object_storage(fs):
          if strict:
              return fs.isdir(path)
  
          # Check if the path is not already taken by a file. If not, it is considered a valid directory-like path
          # because the directory (and all non-existing parent directories) will be created on the fly.
          return not fs.isfile(path)
  
      return fs.isdir(path)
  
file_path: pytorch-lightning/src/lightning/fabric/utilities/cloud_io.py
imports: import io
  import logging
  from pathlib import Path
  from typing import IO, Any, Dict, Union
  import fsspec
  import fsspec.utils
  import torch
  from fsspec.core import url_to_fs
  from fsspec.implementations.local import AbstractFileSystem
  from lightning_utilities.core.imports import module_available
  from lightning.fabric.utilities.types import _MAP_LOCATION_TYPE, _PATH
label_desc: Use image node_id 5 for calling a global function with example usage: _is_dir(fs, path, strict) and returns: fs, unknown, fs