code: def slice(dataset, normal='x', origin=None, generate_triangles=False,
                contour=False):
          
          if isinstance(normal, str):
              normal = NORMALS[normal.lower()]
          # find center of data if origin not specified
          if origin is None:
              origin = dataset.center
          if not is_inside_bounds(origin, dataset.bounds):
              raise AssertionError('Slice is outside data bounds.')
          # create the plane for clipping
          plane = _generate_plane(normal, origin)
          # create slice
          alg = vtk.vtkCutter() # Construct the cutter object
          alg.SetInputDataObject(dataset) # Use the grid as the data we desire to cut
          alg.SetCutFunction(plane) # the the cutter to use the plane we made
          if not generate_triangles:
              alg.GenerateTrianglesOff()
          alg.Update() # Perfrom the Cut
          output = _get_output(alg)
          if contour:
              return output.contour()
          return output
docs: Slice a dataset by a plane at the specified origin and normal vector
          orientation. If no origin is specified, the center of the input dataset will
          be used.
  
          Parameters
          ----------
          normal : tuple(float) or str
              Length 3 tuple for the normal vector direction. Can also be
              specified as a string conventional direction such as ``'x'`` for
              ``(1,0,0)`` or ``'-x'`` for ``(-1,0,0)```, etc.
  
          origin : tuple(float)
              The center (x,y,z) coordinate of the plane on which the slice occurs
  
          generate_triangles: bool, optional
              If this is enabled (``False`` by default), the output will be
              triangles otherwise, the output will be the intersection polygons.
  
          contour : bool, optional
              If True, apply a ``contour`` filter after slicing