def get_age(date: dt.datetime) -> str:
    '\n    Take a datetime and return its "age" as a string.\n\n    The age can be in second, minute, hour, day, month or year. Only the\n    biggest unit is considered, e.g. if it\'s 2 days and 3 hours, "2 days" will\n    be returned.\n    Make sure date is not in the future, or else it won\'t work.\n    '

    def formatn(number: int, unit: str) -> str:
        'Add "unit" if it\'s plural.'
        if (number == 1):
            return f'1 {unit}'
        return f'{number:d} {unit}s'

    def q_n_r(first: int, second: int) -> Tuple[(int, int)]:
        'Return quotient and remaining.'
        return ((first // second), (first % second))
    delta = (now() - date)
    day = delta.days
    second = delta.seconds
    (year, day) = q_n_r(day, 365)
    if (year > 0):
        return formatn(year, 'year')
    (month, day) = q_n_r(day, 30)
    if (month > 0):
        return formatn(month, 'month')
    if (day > 0):
        return formatn(day, 'day')
    (hour, second) = q_n_r(second, 3600)
    if (hour > 0):
        return formatn(hour, 'hour')
    (minute, second) = q_n_r(second, 60)
    if (minute > 0):
        return formatn(minute, 'minute')
    return formatn(second, 'second')
Take a datetime and return its "age" as a string.

The age can be in second, minute, hour, day, month or year. Only the
biggest unit is considered, e.g. if it's 2 days and 3 hours, "2 days" will
be returned.
Make sure date is not in the future, or else it won't work.
def get_age(date: dt.datetime) -> str:
    '\n    Take a datetime and return its "age" as a string.\n\n    The age can be in second, minute, hour, day, month or year. Only the\n    biggest unit is considered, e.g. if it\'s 2 days and 3 hours, "2 days" will\n    be returned.\n    Make sure date is not in the future, or else it won\'t work.\n    '

    def formatn(number: int, unit: str) -> str:
        'Add "unit" if it\'s plural.'
        if (number == 1):
            return f'1 {unit}'
        return f'{number:d} {unit}s'

    def q_n_r(first: int, second: int) -> Tuple[(int, int)]:
        'Return quotient and remaining.'
        return ((first // second), (first % second))
    delta = (now() - date)
    day = delta.days
    second = delta.seconds
    (year, day) = q_n_r(day, 365)
    if (year > 0):
        return formatn(year, 'year')
    (month, day) = q_n_r(day, 30)
    if (month > 0):
        return formatn(month, 'month')
    if (day > 0):
        return formatn(day, 'day')
    (hour, second) = q_n_r(second, 3600)
    if (hour > 0):
        return formatn(hour, 'hour')
    (minute, second) = q_n_r(second, 60)
    if (minute > 0):
        return formatn(minute, 'minute')
    return formatn(second, 'second')