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

def truncstr(text, width, align='right'):
    ''' Truncate a string, with trailing ellipsis. '''
    before = after = ''
    if align == 'left':
        truncated = text[-width+1:]
        before = _ellpico
    elif align:
        truncated = text[:width-1]
        after = _ellpico

    return f'{before}{truncated}{after}'