code: def _slice_intersection(
      a: slice, b: slice, length: int
  ) -> Optional[slice]:
      # Return the intersection of slice a, b. None if they are disjoint.
      a_start, a_stop, a_step = a.indices(length)
      b_start, b_stop, b_step = b.indices(length)
  
      crt_result = _crt(a_start, a_step, b_start, b_step)
      if crt_result is None:
          return None
      c_start, c_step = crt_result
  
      c_stop = min(a_stop, b_stop)
      if c_start >= c_stop:
          return None
  
      return slice(c_start, c_stop, c_step)
  
file_path: cupy/cupyx/distributed/array/_index_arith.py
imports: import typing
  from typing import Any, Optional
label_desc: Use image node_id 3 for calling a global function with example usage: _slice_intersection(a, b, length) and returns: slice, None, None