<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def remove(self, indices):
 """ Remove the fragments corresponding to the given list of indices. :param indices: the list of indices to be removed :type indices: list of int :raises ValueError: if one of the indices is not valid """

        if not self._is_valid_index(indices):
            self.log_exc(u"The given list of indices is not valid", None, True, ValueError)
        new_fragments = []
        sorted_indices = sorted(indices)
        i = 0
        j = 0
        while (i < len(self)) and (j < len(sorted_indices)):
            if i != sorted_indices[j]:
                new_fragments.append(self[i])
            else:
                j += 1
            i += 1
        while i < len(self):
            new_fragments.append(self[i])
            i += 1
        self.__fragments = new_fragments