def pad_line(s, width, align='left'):
    """Pad a string with a given alignment to a specific width with spaces."""
    gap = width - len(s)
    if gap <= 0:
        return s
    elif align == 'left':
        return s + ' ' * gap
    elif align == 'right':
        return ' ' * gap + s
    else:
        raise ValueError('Unknown alignment: {0}'.format(align))
