def create_contexts(data_obj, data_type='plain'):
    '''
    :param data_obj: an object representing a dataset consisting of files
    :param data_type:
    :return:
    '''
    contexts = []
    if 'target' not in data_obj:
        print("No 'target' label in data representations")
        return []

    if 'tags' not in data_obj:
        print("No 'tag' label in data representations or wrong format of tag")
        return []

    for s_idx, sents in enumerate(zip(*data_obj.values())):
        if data_type == 'sequential':
            contexts.append(create_context({data_obj.keys()[i]: sents[i] for i in range(len(sents))}, sentence_id=s_idx))
        else:
            contexts.extend(create_context({data_obj.keys()[i]: sents[i] for i in range(len(sents))}, sentence_id=s_idx))

            # TODO: there is an error here
            if data_type == 'token':
                new_contexts = defaultdict(list)
                for cont in contexts:
                    new_contexts[cont['token']].append(cont)
                    contexts = copy.deepcopy(new_contexts)

    return contexts


# convert list of lists into a flat list
# TODO: there is an error where no code runs here
dataset/ETHPy150Open qe-team/marmot/marmot/experiment/preprocessing_utils.py/create_contexts/original