def relative_time(value):
    '\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 will return None.\n\n    If the input are not a datetime object the input will be returned unmodified.\n    '
    if (not isinstance(value, datetime)):
        return value
    if (not value.tzinfo):
        value = dt_util.as_local(value)
    if (dt_util.now() < value):
        return value
    return dt_util.get_age(value)
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 will return None.

If the input are not a datetime object the input will be returned unmodified.
def relative_time(value):
    '\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 will return None.\n\n    If the input are not a datetime object the input will be returned unmodified.\n    '
    if (not isinstance(value, datetime)):
        return value
    if (not value.tzinfo):
        value = dt_util.as_local(value)
    if (dt_util.now() < value):
        return value
    return dt_util.get_age(value)