def get_series_in_backtests(df, data_subset, present= True, threshold= None):
    """
    Selects the subset of series that are present or absent in any defined backtest
    df: Pandas df
        Output of check_all_series_backtests(), contains information on presence of series in each backtest period
    data_subset: str
        Which data_subsets should be included in analysis, accpets individual backtests ('backtest_1', 'allBacktests', 'holdout')
    present: bool
        Select series that are present (True) or absent (False) from backtesting window(s)
    threshold: np.float (0.0 - 1.0)
        cutoff threshold to determine presence
        
    Returns:
    --------
    series: list
        Series names that match the selection conditions
    """
    
    avail_backtests = df.columns.tolist()[1:]
    if data_subset.lower() == 'allbacktests':
        select_backtest = avail_backtests
    else:   
        assert data_subset in [avail_backtests], 'data_subset must be present in input df'
        select_backtest = data_subset.lower()
    
    
    cutoff = 0
    if threshold is not None:
        cutoff = int(df[select_backtest].max().values.max() * threshold)
    if present:
        print(f'Getting series with present in {cutoff} or more rows in {", ".join(select_backtest)} ...')

        series = df[(df[select_backtest].T >= cutoff).any()].iloc[:,0].tolist()
    else:
        print(f'Getting series with present in {cutoff} or fewer rows rows in {", ".join(select_backtest)} ...')
        if cutoff == 0:
            series = df[(df[select_backtest].T == cutoff).any()].iloc[:,0].tolist()
        else:
            series = df[(df[select_backtest].T < cutoff).any()].iloc[:,0].tolist()
    
    return series