def inner_slice(x, arg):
    padding = [(max(0, (- p[0])), max(0, (p[1] - x.shape[i]))) for (i, p) in enumerate(arg)]
    x = np.pad(x, padding)
    slicee = [((p[0] + padding[i][0]), (p[1] + padding[i][0])) for (i, p) in enumerate(arg)]
    return x[tuple([slice(x[0], x[1], None) for x in slicee])]
def inner_slice(x, arg):
    padding = [(max(0, (- p[0])), max(0, (p[1] - x.shape[i]))) for (i, p) in enumerate(arg)]
    x = np.pad(x, padding)
    slicee = [((p[0] + padding[i][0]), (p[1] + padding[i][0])) for (i, p) in enumerate(arg)]
    return x[tuple([slice(x[0], x[1], None) for x in slicee])]