from datetime import datetime


def _time_ago(time):
    """Represent time past as a friendly string"""
    time_ago = datetime.utcnow() - time
    timestr = []
    if time_ago.days > 1:
        timestr.append("{} days".format(time_ago.days))
    elif time_ago.days == 1:
        timestr.append("1 day")

    # hours
    hours = time_ago.seconds // (60 * 60)
    if hours > 1:
        timestr.append("{} hours".format(hours))
    elif hours == 1:
        timestr.append("1 hour")

    # minutes
    minutes = time_ago.seconds % (60 * 60) // 60
    if minutes > 1:
        timestr.append("{} minutes".format(minutes))
    elif minutes == 1:
        timestr.append("1 minute")

    return ", ".join(timestr)