def pretty_date(time=False):
    now = datetime.datetime.now()
    if type(time) is int:
        diff = now - datetime.datetime.fromtimestamp(time)
    elif isinstance(time, datetime.datetime):
        diff = now - time
    elif not time:
        diff = now - now
    else:
        raise ValueError('need to provide either int, datetime, or None for "time" arg')
    second_diff = diff.seconds
    day_diff = diff.days

    if day_diff < 0:
        return ''

    if day_diff == 0:
        if second_diff < 10:
            return "just now"
        if second_diff < 60:
            return str(second_diff) + " seconds ago"
        if second_diff < 120:
            return "a minute ago"
        if second_diff < 3600:
            return str(second_diff / 60) + " minutes ago"
        if second_diff < 7200:
            return "an hour ago"
        if second_diff < 86400:
            return str(second_diff / 3600) + " hours ago"
    if day_diff == 1:
        return "yesterday"
    if day_diff < 7:
        return str(day_diff) + " days ago"
    if day_diff < 14:
        return "1 week ago"
    if day_diff < 31:
        return str(day_diff/7) + " weeks ago"
    if day_diff < 60:
        return "1 month ago"
    if day_diff < 365:
        return str(day_diff/30) + " months ago"
    if day_diff < 365 * 2:
        remainder = datetime.datetime.now() - (diff - datetime.timedelta(days=365))
        diff = now - remainder
        if diff.days > 31:
            return "1 year, " + pretty_date(remainder)
        else:
            return "1 year ago"
    return str(day_diff/365) + " years ago"
Get a datetime object or a int() Epoch timestamp and return a
dataset/ETHPy150Open YelpArchive/pushmanager/pushmanager/core/util.py/pretty_date