<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 """ Generate a description text for the pingback. """

    link = soup.find('a', href=target)

    content = strip_tags(six.text_type(link.findParent()))
    index = content.index(link.string)

    if len(content) > max_length:
        middle = max_length // 2
        start = index - middle
        end = index + middle

        if start <= 0:
            end -= start
            extract = content[0:end]
        else:
            extract = '%s%s' % (trunc_char, content[start:end])

        if end < len(content):
            extract += trunc_char
        return extract

    return content