def add_metabolites(self, metabolite_list):
if not hasattr(metabolite_list, '<STR_LIT>'):<EOL><INDENT>metabolite_list = [metabolite_list]<EOL><DEDENT>if len(metabolite_list) == <NUM_LIT:0>:<EOL><INDENT>return None<EOL><DEDENT>metabolite_list = [x for x in metabolite_list<EOL>if x.id not in self.metabolites]<EOL>bad_ids = [m for m in metabolite_list<EOL>if not isinstance(m.id, string_types) or len(m.id) < <NUM_LIT:1>]<EOL>if len(bad_ids) != <NUM_LIT:0>:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(repr(bad_ids)))<EOL><DEDENT>for x in metabolite_list:<EOL><INDENT>x._model = self<EOL><DEDENT>self.metabolites += metabolite_list<EOL>to_add = []<EOL>for met in metabolite_list:<EOL><INDENT>if met.id not in self.constraints:<EOL><INDENT>constraint = self.problem.Constraint(<EOL>Zero, name=met.id, lb=<NUM_LIT:0>, ub=<NUM_LIT:0>)<EOL>to_add += [constraint]<EOL><DEDENT><DEDENT>self.add_cons_vars(to_add)<EOL>context = get_context(self)<EOL>if context:<EOL><INDENT>context(partial(self.metabolites.__isub__, metabolite_list))<EOL>for x in metabolite_list:<EOL><INDENT>context(partial(setattr, x, '<STR_LIT>', None))<EOL><DEDENT><DEDENT>
Will add a list of metabolites to the model object and add new
        constraints accordingly.

        The change is reverted upon exit when using the model as a context.

        Parameters
        ----------
        metabolite_list : A list of `cobra.core.Metabolite` objects