code: def toindices(self, mask):
          r
          if sp.amax(mask) > 1:
              raise Exception('Received mask is invalid, with values above 1')
          mask = sp.array(mask, dtype=bool)
          indices = self._parse_indices(mask)
          return indices
docs: r"""
          Convert a boolean mask to a list of pore or throat indices
  
          Parameters
          ----------
          mask : array_like booleans
              A boolean array with True at locations where indices are desired.
              The appropriate indices are returned based an the length of mask,
              which must be either Np or Nt long.
  
          Returns
          -------
          A list of pore or throat indices corresponding the locations where
          the received mask was True.
  
          See Also
          --------
          tomask
  
          Notes
          -----
          This behavior could just as easily be accomplished by using the mask
          in ``pn.pores()[mask]`` or ``pn.throats()[mask]``.  This method is
          just a convenience function and is a complement to ``tomask``.