def expand_slice(s, a, b, start=0, stop=None):
    '''Expand a slice on the start/stop limits'''
    n1 = max(s.start - a, start)
    n2 = s.stop + b
    if stop is not None:
        n2 = min(n2, stop)

    return slice(n1, n2, 1)