def get_sub_image(data, M, N, m, n):
    """Divides the image into M*N parts and returns the grid on row m and column n
       -----------
       parameters
       -----------
       data -> The image array that we are extracting the sub-image/grid-cell from.
       M -> Number of grid rows
       N -> Number of grid columns
       m -> row index of grid cell we need to return
       n -> column index of grid cell we need to return
       -----------
       returns
       -----------
       Sub array from input array.
    """
    rows, columns = data.shape[0:2]
    assert M <= rows and N <= columns, "Grid dimensions exceed Image dimensions"
    return data[m*int(rows/M): (m+1)*int(rows/M), n*int(columns/N): (n+1)*int(columns/N)]