def cobrunion(models=[], based_on='id'):
    """
    Union of the models as a list
    INPUTS -> models, list of Cobra Model objects,
            based_on: string, "id" or "name", choose whatever you want.
    OUPUT -> list of union of extracellular metabolites
    """
    piece = 'name' if based_on.lower() in ['name', 'names'] else 'id'
    ex_mets = set()
    for model in models:
        for met in model.metabolites:
            if not met.compartment:
                print(
                    f"{met.id} with name {met.name} haven't got an specified compartment attribute."
                    )
            elif met.compartment in ['e', 'e0', 'ExtraCellular',
                'extracellular']:
                ex_mets.add(met.__getattribute__(piece))
    return ex_mets
