def METHOD_NAME(path: str, frames: Iterable, shared_filesystem: bool, gds=False) -> dict:
    """Write frames to disk
    Parameters
    ----------
    path: str
        File path
    frames: Iterable
        The frames to write to disk
    shared_filesystem: bool
        Whether the target filesystem is shared between all workers or not.
        If True, the filesystem must support the `os.link()` operation.
    gds: bool
        Enable the use of GPUDirect Storage. Notice, the consecutive
        `disk_read()` must enable GDS as well.
    Returns
    -------
    header: dict
        A dict of metadata
    """
    cuda_frames = tuple(hasattr(f, "__cuda_array_interface__") for f in frames)
    if gds and any(cuda_frames):
        import kvikio
        # Write each frame consecutively into `path` in parallel
        with kvikio.CuFile(path, "w") as f:
            file_offsets = itertools.accumulate(map(nbytes, frames), initial=0)
            futures = [f.pwrite(b, file_offset=o) for b, o in zip(frames, file_offsets)]
            for each_fut in futures:
                each_fut.get()
    else:
        with open(path, "wb") as f:
            os.writev(f.fileno(), frames)  # type: ignore
    return {
        "method": "stdio",
        "path": SpillToDiskFile(path),
        "frame-lengths": tuple(map(nbytes, frames)),
        "shared-filesystem": shared_filesystem,
        "cuda-frames": cuda_frames,
    }