def _abbreviate(text, threshold):
 if ((text is not None) and (len(text) > threshold)):
  text = (text[:threshold] + '...')
 return text

def _abbreviate ( text , threshold ) : if ( ( text is not None ) and ( len ( text ) > threshold ) ) : text = ( text [ : threshold ] + '...' ) return text
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 .