code: def find_clusters(network, mask=[], t_labels=False):
      r
      # Parse the input arguments
      mask = sp.array(mask, ndmin=1)
      if mask.dtype != bool:
          raise Exception('Mask must be a boolean array of Np or Nt length')
  
      # If pore mask was given perform site percolation
      if sp.size(mask) == network.Np:
          (p_clusters, t_clusters) = _site_percolation(network, mask)
      # If pore mask was given perform bond percolation
      elif sp.size(mask) == network.Nt:
          (p_clusters, t_clusters) = _bond_percolation(network, mask)
      else:
          raise Exception('Mask received was neither Nt nor Np long')
  
      return (p_clusters, t_clusters)
docs: r"""
      Identify connected clusters of pores in the network.  This method can
      also return a list of throat cluster numbers, which correspond to the
      cluster numbers of the pores to which the throat is connected.  Either
      site and bond percolation can be considered, see description of input
      arguments for details.
  
      Parameters
      ----------
      network : OpenPNM Network Object
          The network
  
      mask : array_like, boolean
          A list of active bonds or sites (throats or pores).  If the mask is
          Np long, then the method will perform a site percolation, and if
          the mask is Nt long bond percolation will be performed.
  
      Returns
      -------
      A tuple containing an Np long list of pore cluster labels, and an Nt-long
      list of throat cluster labels.  The label numbers correspond such that
      pores and throats with the same label are part of the same cluster.
  
      Examples
      --------
      >>> import openpnm as op
      >>> from scipy import rand
      >>> pn = op.network.Cubic(shape=[25, 25, 1])
      >>> pn['pore.seed'] = rand(pn.Np)
      >>> pn['throat.seed'] = rand(pn.Nt)