code: def remove_isolated_clusters(labels, inlets):
      r
      # Identify clusters of invasion sites
      inv_clusters = sp.unique(labels.sites[inlets])
      # Remove cluster numbers == -1, if any
      inv_clusters = inv_clusters[inv_clusters >= 0]
      # Find all pores in invading clusters
      p_invading = sp.in1d(labels.sites, inv_clusters)
      labels.sites[~p_invading] = -1
      t_invading = sp.in1d(labels.bonds, inv_clusters)
      labels.bonds[~t_invading] = -1
      return labels
docs: r"""
      Finds cluster labels not attached to the inlets, and sets them to
      unoccupied (-1)
  
      Parameters
      ----------
      labels : tuple of site and bond labels
          This information is provided by the ``site_percolation`` or
          ``bond_percolation`` functions
  
      inlets : array_like
          A list of which sites are inlets.  Can be a boolean mask or an
          array of indices.
  
      Returns
      -------
      A tuple containing a list of site and bond labels, with all clusters
      not connected to the inlet sites set to not occupied.