def slice2slice(slc):
    """slice of matlab style to slice of python style
for example: M[1:3] := M[0:3]
>>> slice2slice(slice(1, 6, 2))
slice(0, 6, 2)
>>> slice2slice(slice(-3, 0))
slice(-4, None, None)
>>> ind2ind(slice(5,2,-1))
slice(4, 0, -1)
"""
    a, b, c = slc.start, slc.stop, slc.step
    if c is None or c > 0:
        return slice(a - 1 if a else None, None if b == 0 else b, c)
    elif c < 0:
        return slice(a - 1 if a else None, None if b == 1 or b is None else
            b - 2, c)
    else:
        raise ValueError('slice step cannot be zero!')
