code: def connectivity(dataset, largest=False):
          
          alg = vtk.vtkConnectivityFilter()
          alg.SetInputData(dataset)
          if largest:
              alg.SetExtractionModeToLargestRegion()
          else:
              alg.SetExtractionModeToAllRegions()
          alg.SetColorRegions(True)
          alg.Update()
          return _get_output(alg)
docs: Find and label connected bodies/volumes. This adds an ID array to
          the point and cell data to distinguish seperate connected bodies.
          This applies a ``vtkConnectivityFilter`` filter which extracts cells
          that share common points and/or meet other connectivity criterion.
          (Cells that share vertices and meet other connectivity criterion such
          as scalar range are known as a region.)
  
          Parameters
          ----------
          largest : bool
              Extract the largest connected part of the mesh.