import warnings


def _label_compcor(confounds_raw, compcor_suffix, n_compcor):
    """Builds list for the number of compcor components."""
    compcor_cols = []
    for nn in range(n_compcor + 1):
        nn_str = str(nn).zfill(2)
        compcor_col = compcor_suffix + "_comp_cor_" + nn_str
        if compcor_col not in confounds_raw.columns:
            warnings.warn(f"could not find any confound with the key {compcor_col}")
        else:
            compcor_cols.append(compcor_col)

    return compcor_cols