<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_trial_stats(self, trial, result):
 """Update result for trial. Called after trial has finished an iteration - will decrement iteration count. TODO(rliaw):
 The other alternative is to keep the trials in and make sure they're not set as pending later."""


        assert trial in self._live_trials
        assert self._get_result_time(result) >= 0

        delta = self._get_result_time(result) - \
            self._get_result_time(self._live_trials[trial])
        assert delta >= 0
        self._completed_progress += delta
        self._live_trials[trial] = result