def truncate_rationale(rationale, max_length=MAX_RATIONALE_SIZE_IN_EVENT):
if isinstance(rationale, basestring) and max_length is not None and len(rationale) > max_length:<EOL><INDENT>return rationale[<NUM_LIT:0>:max_length], True<EOL><DEDENT>else:<EOL><INDENT>return rationale, False<EOL><DEDENT>
Truncates the rationale for analytics event emission if necessary

Args:
    rationale (string): the string value of the rationale
    max_length (int): the max length for truncation

Returns:
    truncated_value (string): the possibly truncated version of the rationale
    was_truncated (bool): returns true if the rationale is truncated