code: def slice2gridspec(key):
      """Convert a 2-tuple of slices to start,stop,steps for x and y.
  
      key -- (slice(ystart,ystop,ystep), slice(xtart, xstop, xstep))
  
      For now, the only accepted step values are imaginary integers (interpreted
      in the same way numpy.mgrid, etc. do).
      """
      if (
          (len(key) != 2)
          or (not isinstance(key[0], slice))
          or (not isinstance(key[1], slice))
      ):
          raise ValueError("only 2-D slices, please")
  
      x0 = key[1].start
      x1 = key[1].stop
      xstep = key[1].step
      if (
          not isinstance(xstep, complex)
          or int(xstep.real) != xstep.real
      ):
          raise ValueError(
              "only the [start:stop:numsteps*1j] form supported"
          )
      xstep = int(xstep.imag)
      y0 = key[0].start
      y1 = key[0].stop
      ystep = key[0].step
      if (
          not isinstance(ystep, complex)
          or int(ystep.real) != ystep.real
      ):
          raise ValueError(
              "only the [start:stop:numsteps*1j] form supported"
          )
      ystep = int(ystep.imag)
  
      return x0, x1, xstep, y0, y1, ystep
  
file_path: nupic-legacy/external/linux32arm/lib/python2.7/site-packages/matplotlib/delaunay/interpolate.py
imports: import numpy
  from matplotlib._delaunay import compute_planes, linear_interpolate_grid, nn_interpolate_grid
  from matplotlib._delaunay import nn_interpolate_unstructured
label_desc: Use image node_id 1 for calling a global function with example usage: slice2gridspec(key) and returns: x0,  x1,  xstep,  y0,  y1,  ystep