def remaining_time(self):
        """
        estimates the time remaining until script is finished
        """
        elapsed_time = (datetime.datetime.now() - self.start_time).total_seconds()
        # safety to avoid devision by zero
        if self.progress == 0:
            self.progress = 1

        estimated_total_time = 100. / self.progress * elapsed_time

        return datetime.timedelta(seconds = max(estimated_total_time - elapsed_time, 0))
def remaining_time ( self ) : elapsed_time = ( datetime . datetime . now ( ) - self . start_time ) . total_seconds ( ) if self . progress == 0 : self . progress = 1 estimated_total_time = 100. / self . progress * elapsed_time return datetime . timedelta ( seconds = max ( estimated_total_time - elapsed_time , 0 ) )
estimates the time remaining until script is finished