def flatten_index(index: tuple, shape: tuple) -> int:
    """ Unravel index

    Convert flatten index into tuple index.

    Parameters
    ----------
    index: tuple
        index (x, y)
    shape: tuple
        shape of matrix the flatten index is about

    Returns
    -------
    index: int64
        flatten index
    """
    return index[0] * shape[0] + index[1]