<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update(self, value, timestamp=None):
 """Add a value to the reservoir. :param value: the value to be added :param timestamp: the epoch timestamp of the value in seconds, defaults to the current timestamp if not specified. """


        if timestamp is None:
            timestamp = self.current_time_in_fractional_seconds()
        self.rescale_if_needed()
        priority = self.weight(timestamp - self.start_time) / random.random()
        self.values[priority] = value
        if len(self.values) > self.size:
            self.values.remove_min()