def selectblock(cov, spectra, n_bins, block='TTTT'):
    """Select a block in a spin0 and 2 covariance matrix

    Parameters
    ----------

    cov: 2d array
      the covariance matrix
    spectra: list of strings
      the arangement of the different block
    n_bins: int
      the number of bins for each block
    block: string
      the block you want to look at
    """
    if spectra == None:
        print('cov mat of spin 0, no block selection needed')
        return
    else:
        blockindex = {}
        for c1, s1 in enumerate(spectra):
            for c2, s2 in enumerate(spectra):
                blockindex[s1 + s2] = [c1 * n_bins, c2 * n_bins]
    id1 = blockindex[block][0]
    id2 = blockindex[block][1]
    cov_select = cov[id1:id1 + n_bins, id2:id2 + n_bins]
    return cov_select
