import configparser
import itertools


def get_imputation_featureset_combis(imputations: list, featuresets: list, target_column: str) -> list:
    """
    Function delivering imputation and featureset combinations which make sense
    :param imputations: imputations to use
    :param featuresets: featuresets to use
    :param target_column: target_column for retrieving info from config file
    :return: list of combinations which make sense
    """
    config = configparser.ConfigParser()
    config.read('Configs/dataset_specific_config.ini')
    multiple_nans_raw_set = config[target_column].getboolean('multiple_nans_raw_set')
    imp_feat_combis = list(itertools.product(*[imputations, featuresets]))
    if not multiple_nans_raw_set:
        for (imp, feat) in imp_feat_combis.copy():
            if (feat == 'cal' or feat == 'none') and (imp == 'iterative' or imp == 'knn'):
                imp_feat_combis.remove((imp, feat))
    return imp_feat_combis