<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def normalize(self, normalizationLevel="minute", fusionMethod="mean", interpolationMethod="linear"):
 """Normalizes the TimeSeries data points. If this function is called, the TimeSeries gets ordered ascending automatically. The new timestamps will represent the center of each time bucket. Within a normalized TimeSeries, the temporal distance between two consecutive data points is constant. :param string normalizationLevel: Level of normalization that has to be applied. The available normalization levels are defined in :py:data:`timeseries.NormalizationLevels`. :param string fusionMethod: Normalization method that has to be used if multiple data entries exist within the same normalization bucket. The available methods are defined in :py:data:`timeseries.FusionMethods`. :param string interpolationMethod: Interpolation method that is used if a data entry at a specific time is missing. The available interpolation methods are defined in :py:data:`timeseries.InterpolationMethods`. :raise: Raises a :py:exc:`ValueError` if a normalizationLevel, fusionMethod or interpolationMethod hanve an unknown value. """

        # do not normalize the TimeSeries if it is already normalized, either by
        # definition or a prior call of normalize(*)
        if self._normalizationLevel == normalizationLevel:
            if self._normalized:    # pragma: no cover
                return

        # check if all parameters are defined correctly
        if normalizationLevel not in NormalizationLevels:
            raise ValueError("Normalization level %s is unknown." % normalizationLevel)
        if fusionMethod not in FusionMethods:
            raise ValueError("Fusion method %s is unknown." % fusionMethod)
        if interpolationMethod not in InterpolationMethods:
            raise ValueError("Interpolation method %s is unknown." % interpolationMethod)

        # (nearly) empty TimeSeries instances do not require normalization
        if len(self) < 2:
            self._normalized = True
            return

        # get the defined methods and parameter
        self._normalizationLevel = normalizationLevel
        normalizationLevel       = NormalizationLevels[normalizationLevel]
        fusionMethod             = FusionMethods[fusionMethod]
        interpolationMethod      = InterpolationMethods[interpolationMethod]

        # sort the TimeSeries
        self.sort_timeseries()

        # prepare the required buckets
        start           = self._timeseriesData[0][0]
        end             = self._timeseriesData[-1][0]
        span            = end - start
        bucketcnt       = int(span / normalizationLevel) + 1

        buckethalfwidth = normalizationLevel / 2.0
        bucketstart     = start + buckethalfwidth
        buckets         = [[bucketstart + idx * normalizationLevel] for idx in xrange(bucketcnt)]

        # Step One: Populate buckets
        # Initialize the timeseries data iterators
        tsdStartIdx = 0
        tsdEndIdx   = 0
        tsdlength   = len(self)

        for idx in xrange(bucketcnt):
            # get the bucket to avoid multiple calls of buckets.__getitem__()
            bucket = buckets[idx]

            # get the range for the given bucket
            bucketend   = bucket[0] + buckethalfwidth

            while tsdEndIdx < tsdlength and self._timeseriesData[tsdEndIdx][0] < bucketend:
                tsdEndIdx += 1

            # continue, if no valid data entries exist
            if tsdStartIdx == tsdEndIdx:
                continue

            # use the given fusion method to calculate the fusioned value
            values = [i[1] for i in self._timeseriesData[tsdStartIdx:tsdEndIdx]]
            bucket.append(fusionMethod(values))

            # set the new timeseries data index
            tsdStartIdx = tsdEndIdx

        # Step Two: Fill missing buckets
        missingCount   = 0
        lastIdx        = 0
        for idx in xrange(bucketcnt):
            # bucket is empty
            if 1 == len(buckets[idx]):
                missingCount += 1
                continue

            # This is the first bucket. The first bucket is not empty by definition!
            if idx == 0:
                lastIdx = idx
                continue

            # update the lastIdx, if none was missing
            if 0 == missingCount:
                lastIdx = idx
                continue

            # calculate and fill in missing values
            missingValues = interpolationMethod(buckets[lastIdx][1], buckets[idx][1], missingCount)
            for idx2 in xrange(1, missingCount + 1):
                buckets[lastIdx + idx2].append(missingValues[idx2 - 1])

            lastIdx = idx
            missingCount = 0

        self._timeseriesData = buckets

        # at the end set self._normalized to True
        self._normalized = True