def _truncate_explanation(input_lines, max_lines=None, max_chars=None):
if max_lines is None:<EOL><INDENT>max_lines = DEFAULT_MAX_LINES<EOL><DEDENT>if max_chars is None:<EOL><INDENT>max_chars = DEFAULT_MAX_CHARS<EOL><DEDENT>input_char_count = len("<STR_LIT>".join(input_lines))<EOL>if len(input_lines) <= max_lines and input_char_count <= max_chars:<EOL><INDENT>return input_lines<EOL><DEDENT>truncated_explanation = input_lines[:max_lines]<EOL>truncated_explanation = _truncate_by_char_count(truncated_explanation, max_chars)<EOL>truncated_explanation[-<NUM_LIT:1>] = truncated_explanation[-<NUM_LIT:1>] + "<STR_LIT>"<EOL>truncated_line_count = len(input_lines) - len(truncated_explanation)<EOL>truncated_line_count += <NUM_LIT:1>  <EOL>msg = "<STR_LIT>"<EOL>if truncated_line_count == <NUM_LIT:1>:<EOL><INDENT>msg += "<STR_LIT>".format(truncated_line_count)<EOL><DEDENT>else:<EOL><INDENT>msg += "<STR_LIT>".format(truncated_line_count)<EOL><DEDENT>msg += "<STR_LIT>".format(USAGE_MSG)<EOL>truncated_explanation.extend([six.text_type("<STR_LIT>"), six.text_type(msg)])<EOL>return truncated_explanation<EOL>
Truncate given list of strings that makes up the assertion explanation.

Truncates to either 8 lines, or 640 characters - whichever the input reaches
first. The remaining lines will be replaced by a usage message.