def pretty_date(ugly_time=False, ln=None):
ln = default_ln(ln)<EOL>_ = gettext_set_language(ln)<EOL>now = real_datetime.now()<EOL>if isinstance(ugly_time, six.string_types):<EOL><INDENT>date_format = '<STR_LIT>'<EOL>try:<EOL><INDENT>ugly_time = time.strptime(ugly_time, date_format)<EOL>ugly_time = int(time.mktime(ugly_time))<EOL><DEDENT>except ValueError:<EOL><INDENT>try:<EOL><INDENT>ugly_time = int(guess_datetime(ugly_time))<EOL><DEDENT>except ValueError:<EOL><INDENT>return ugly_time<EOL><DEDENT>ugly_time = int(time.mktime(ugly_time))<EOL><DEDENT><DEDENT>if isinstance(ugly_time, int):<EOL><INDENT>diff = now - real_datetime.fromtimestamp(ugly_time)<EOL><DEDENT>elif isinstance(ugly_time, real_datetime):<EOL><INDENT>diff = now - ugly_time<EOL><DEDENT>elif not ugly_time:<EOL><INDENT>diff = now - now<EOL><DEDENT>second_diff = diff.seconds<EOL>day_diff = diff.days<EOL>if day_diff < <NUM_LIT:0>:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if day_diff == <NUM_LIT:0>:<EOL><INDENT>if second_diff < <NUM_LIT:10>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>if second_diff < <NUM_LIT>:<EOL><INDENT>return str(second_diff) + _("<STR_LIT>")<EOL><DEDENT>if second_diff < <NUM_LIT>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>if second_diff < <NUM_LIT>:<EOL><INDENT>return str(second_diff / <NUM_LIT>) + _("<STR_LIT>")<EOL><DEDENT>if second_diff < <NUM_LIT>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>if second_diff < <NUM_LIT>:<EOL><INDENT>return str(second_diff / <NUM_LIT>) + _("<STR_LIT>")<EOL><DEDENT><DEDENT>if day_diff == <NUM_LIT:1>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>if day_diff < <NUM_LIT:7>:<EOL><INDENT>return str(day_diff) + _("<STR_LIT>")<EOL><DEDENT>if day_diff < <NUM_LIT>:<EOL><INDENT>if day_diff / <NUM_LIT:7> == <NUM_LIT:7>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return str(day_diff / <NUM_LIT:7>) + _("<STR_LIT>")<EOL><DEDENT><DEDENT>if day_diff < <NUM_LIT>:<EOL><INDENT>if day_diff / <NUM_LIT:30> == <NUM_LIT:1>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return str(day_diff / <NUM_LIT:30>) + _("<STR_LIT>")<EOL><DEDENT><DEDENT>if day_diff / <NUM_LIT> == <NUM_LIT:1>:<EOL><INDENT>return _("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>return str(day_diff / <NUM_LIT>) + _("<STR_LIT>")<EOL><DEDENT>
Get a datetime object or a int() Epoch timestamp and return a pretty
    string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc.