<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_scheduled_time(self, when):
 """ Updates a scheduled task's date to the given date. If the task is not scheduled, a TaskNotFound exception is raised. """

        tiger = self.tiger

        ts = get_timestamp(when)
        assert ts

        pipeline = tiger.connection.pipeline()
        key = tiger._key(SCHEDULED, self.queue)
        tiger.scripts.zadd(key, ts, self.id, mode='xx', client=pipeline)
        pipeline.zscore(key, self.id)
        _, score = pipeline.execute()
        if not score:
            raise TaskNotFound('Task {} not found in queue "{}" in state "{}".'.format(
                self.id, self.queue, SCHEDULED
            ))

        self._ts = ts