def _abbreviate(text, threshold):
if text is not None and len(text) > threshold:<EOL><INDENT>text = text[:threshold] + "<STR_LIT>"<EOL><DEDENT>return text<EOL>
Abbreviate the given text to threshold chars and append an ellipsis if its
    length exceeds threshold; used for logging;

    NOTE: the resulting text could be longer than threshold due to the ellipsis