code: def optimize(
      graph: ChunkGraph, engines: List[str] = None
  ) -> ChunkGraph:
      if engines is None:
          engines = ["numexpr", "cupy"]
  
      for engine in engines:
          optimizer_cls = _engine_to_optimizers[engine]
          optimizer = optimizer_cls(graph)
          if not optimizer.is_available():
              continue
          optimizer.optimize()
  
      return graph
  
file_path: mars/mars/optimization/physical/core.py
imports: from abc import ABC, abstractmethod
  from typing import List, Tuple, Dict, Type
  from ...core import ChunkGraph, ChunkType, OperandType
  from ...utils import build_fuse_chunk
label_desc: Use image node_id 2 for calling a global function with example usage: optimize(graph, engines) and returns: graph