def format_datetime(datetime):
    return datetime.strftime('%Y-%m-%d %H:%M:%S')

def format_timedelta(timedelta_obj):
    hours, remainder = divmod(timedelta_obj.seconds, 3600)
    minutes, seconds = divmod(remainder, 60)
    if timedelta_obj.days >= 0:
        days = timedelta_obj.days
    else:
        days = abs(timedelta_obj.days) - 1
    return {'days': days,
            'hours': hours,
            'minutes': minutes,
            'seconds': seconds}

@@ -224,147 +224,47 @@
     
-if timedelta_obj.days %3E= 0:%0A        days = timedelta_obj.days%0A    else:%0A        days = abs(timedelta_obj.days) - 1%0A    return %7B'days': days
+return %7B'days': abs(timedelta_obj.days)
 ,%0A  

Revert "utils.restformat: Handle negative deltas correctly."