<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def sample(self, percentage):
 """Samples with replacement from the TimeSeries. Returns the sample and the remaining timeseries. The original timeseries is not changed. :param float percentage: How many percent of the original timeseries should be in the sample :return: A tuple containing (sample, rest) as two TimeSeries. :rtype: tuple(TimeSeries,TimeSeries) :raise: Raises a ValueError if percentage is not in (0.0, 1.0). """

        if not (0.0 < percentage < 1.0):
            raise ValueError("Parameter percentage has to be in (0.0, 1.0).")

        cls         = self.__class__
        value_count = int(len(self) * percentage)
        values      = random.sample(self, value_count)

        sample      = cls.from_twodim_list(values)
        rest_values = self._timeseriesData[:]

        for value in values:
            rest_values.remove(value)

        rest = cls.from_twodim_list(rest_values)

        return sample, rest