def estimate_completion(self):
        """
        Estimate completion time for a task.

        :returns: deferred that when fired returns a datetime object for the
                  estimated, or the actual datetime, or None if we could not
                  estimate a time for this task method.
        """
        if self.completion_ts:
            # Task is already complete. Return the exact completion time:
            defer.returnValue(self.completed)
        # Get the timestamps from the descendent task that's doing the work:
        if self.method == 'build' or self.method == 'image':
            subtask_completion = yield self.estimate_descendents()
            defer.returnValue(subtask_completion)
        if self.state == task_states.FREE:
            est_completion = yield self._estimate_free()
            defer.returnValue(est_completion)
        avg_delta = yield self.estimate_duration()
        if avg_delta is None:
            defer.returnValue(None)
        est_completion = self.started + avg_delta
        defer.returnValue(est_completion)
Estimate completion time for a task.

        :returns: deferred that when fired returns a datetime object for the
                  estimated, or the actual datetime, or None if we could not
                  estimate a time for this task method.