def chomp(text, max_len=<NUM_LIT>, split=None):
split = split or '<STR_LIT>'<EOL>while length(text) > max_len:<EOL><INDENT>try:<EOL><INDENT>text = re.split(r'<STR_LIT:[>' + split + '<STR_LIT:]>', text[::-<NUM_LIT:1>], <NUM_LIT:1>)[<NUM_LIT:1>][::-<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>return text<EOL><DEDENT><DEDENT>return text<EOL>
Shorten a string so that it fits under max_len, splitting it at 'split'.
Not guaranteed to return a string under max_len, as it may not be possible

Args:
    text (str): String to shorten
    max_len (int): maximum length. default 140
    split (str): strings to split on (default is common punctuation: "-;,.")