code: def estimate_duration(self):
          
          if self.completion_ts:
              # Task is already complete. Return the exact duration timedelta.
              return defer.succeed(self.duration)
          if not self.package:
              # TODO: estimate duration some other way besides
              # getAverageBuildDuration. For example, we could estimate
              # completion time for newRepo/createrepo tasks by looking back at
              # the the past couple of tasks for this tag.
              return defer.succeed(None)
          if self.method == 'tagBuild':
              # These are pretty short. Haphazardly guess the max SLEEPTIME plus
              # a few seconds.
              tag_build_time = SLEEPTIME + timedelta(seconds=15)
              return defer.succeed(tag_build_time)
          return average_build_duration(self.connection, self.package)
docs: Estimate duration (timedelta) for this task.
  
          Estimate the average length of time we expect between this task's
          start and end times.
  
          :returns: deferred that when fired returns a timedelta object for the
                    estimated timedelta, or the actual timedelta, or None if we
                    could not estimate a time for this task method.