<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_grouped_indices(self, voigt=False, **kwargs):
 """ 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. or Returns: list of index groups where tensor values are equivalent to within tolerances """

        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]