<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cut_to_length(text, length, delim):
 """Shorten given text on first delimiter after given number of characters. """

    cut = text.find(delim, length)
    if cut > -1:
        return text[:cut]
    else:
        return text