def getitem(M, k):
    """
    Returns the value of entry k in M, where k is a 2-tuple of indices
    >>> M = Mat([[1,2,3],[1,2,3]])
    >>> M[0,0]
    1
    >>> M[1,2]
    3
    """
    assert k[0] in range(M.size[0]) and k[1] in range(M.size[1])
    return M.store[k[0]][k[1]]