code: def get_grouped_indices(self, voigt=False, **kwargs):
          
          if voigt:
              array = self.voigt
          else:
              array = self
  
          indices = list(itertools.product(*[range(n) for n in array.shape]))
          remaining = indices.copy()
          # Start with everything near zero
          grouped = [list(zip(*np.where(np.isclose(array, 0, **kwargs))))]
          remaining = [i for i in remaining if i not in grouped[0]]
          # Iteratively run through remaining indices
          while remaining:
              new = list(zip(*np.where(np.isclose(
                  array, array[remaining[0]], **kwargs))))
              grouped.append(new)
              remaining = [i for i in remaining if i not in new]
          # Don't return any empty lists
          return [g for g in grouped if g]
docs: Gets index sets for equivalent tensor values
  
          Args:
              voigt (bool): whether to get grouped indices
                  of voigt or full notation tensor, defaults
                  to false
              **kwargs: keyword args for np.isclose.  Can take atol
                  and rtol for absolute and relative tolerance, e. g.
  
                  >>> tensor.group_array_indices(atol=1e-8)
  
                  or
  
                  >>> tensor.group_array_indices(rtol=1e-5)
  
          Returns:
              list of index groups where tensor values are equivalent to
              within tolerances