def METHOD_NAME(compcor_cols, n_compcor):
    """Retain a specified number of compcor components.
    Parameters
    ----------
    compcor_cols : :obj:`list`
        List of compcor components column names filtered by user
        selected CompCor strategy.
    n_compcor : :obj:`int` or :obj:`str`
        Number of compcor components to retain. If "all", all components
        are retained.
    Returns
    -------
    compcor_cols : :obj:`list`
        List of compcor components column names to retain.
    """
    # only select if not "all", or less components are requested than there
    # actually is
    if (n_compcor != "all") and (n_compcor < len(compcor_cols)):
        compcor_cols = compcor_cols[:n_compcor]
    return compcor_cols