<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def generate_headline_from_description(sender, instance, *args, **kwargs):
    '''
    Auto generate the headline of the node from the first lines of the description.
    '''
    lines = instance.description.split('\n')
    headline = truncatewords(lines[0], 20)
    if headline[:-3] == '...':
        headline = truncatechars(headline.replace(' ...', ''), 250)  # Just in case the words exceed char limit.
    else:
        headline = truncatechars(headline, 250)
    instance.headline = headline