def slice_sparse(mat, slice0, slice1):
    """
    Slice a block out of a sparse matrix, ie mat[slice0,slice1]. 
    Scipy sparse matrices do not support slicing in this manner (unlike numpy)

    Args: 
        mat (sparse): of any form 
        slice0 (bool,array): mask to apply on axis 0 (rows)
        slice1 (bool,array): mask to apply on axis 1 (columns)

    Returns: 
        CSR matrix
    """
    
    out = mat.tocsc()[:,slice1]
    return out.tocsr()[slice0,:]