code: def test_write_fusion(ray_start_regular_shared, tmp_path):
      context = DataContext.get_current()
      context.optimize_fuse_stages = True
      context.optimize_fuse_read_stages = True
      context.optimize_fuse_shuffle_stages = True
  
      path = os.path.join(tmp_path, "out")
      ds = ray.data.range(100).map_batches(lambda x: x)
      ds.write_csv(path)
      stats = ds._write_ds.stats()
      assert "ReadRange->MapBatches(<lambda>)->Write" in stats, stats
  
      ds = (
          ray.data.range(100)
          .map_batches(lambda x: x)
          .random_shuffle()
          .map_batches(lambda x: x)
      )
      ds.write_csv(path)
      stats = ds._write_ds.stats()
      assert "ReadRange->MapBatches(<lambda>)" in stats, stats
      assert "RandomShuffle" in stats, stats
      assert "MapBatches(<lambda>)->Write" in stats, stats
  
imports: import os
  from typing import List
  import numpy
  import pandas
  import pytest
  import ray
  from ray._private.internal_api import memory_summary
  from ray.data import Dataset
  from ray.data.block import BlockMetadata
  from ray.data.context import DataContext
  from ray.data.datasource import Datasource, ReadTask
  from ray.data.datasource.csv_datasource import CSVDatasource
  from ray.data.tests.util import column_udf, extract_values
  from ray.tests.conftest import *
label_desc: Use image node_id 10 for calling a global function with example usage: test_write_fusion(ray_start_regular_shared, tmp_path) without return types