def prettydate(d):
    diff = datetime.datetime.utcnow() - d
s = diff.seconds
if diff.days > 7 or diff.days < 0:
    return d.strftime('%d %b %y')
elif diff.days == 1:
    return '1 day ago'
elif diff.days > 1:
    return '{} days ago'.format(diff.days)
elif s <= 1:
    return 'just now'
elif s < 60:
    pass
Натуральные/относительные дни в Python