def dayssince(value, today=None):
    """
    Returns the days since passed datetime in a user friendly way. (e.g. today, yesterday, 2 days ago, ...)
    :param value: a date instance
    :param today: date to compare to (defaults to today)
    :returns: the formatted string
    """

    if today is None:
        today = timezone.localtime().date()

    delta = today - value
    days_ago = _("%(days_ago)s days ago") % {"days_ago": str(delta.days)}

    if delta < datetime.timedelta(days=1):
        return _("today")
    if delta < datetime.timedelta(days=2):
        return _("yesterday")

    # use standard timesince for anything beyond yesterday
    return days_ago

    Returns the days since passed datetime in a user friendly way. (e.g. today, yesterday, 2 days ago, ...)
    :param value: a date instance
    :param today: date to compare to (defaults to today)
    :returns: the formatted string
    
core/templatetags/duration.py