code: def escape_ID(cobra_model):
      
      for x in chain([cobra_model],
                     cobra_model.metabolites,
                     cobra_model.reactions,
                     cobra_model.genes):
          x.id = _escape_str_id(x.id)
      cobra_model.repair()
      gene_renamer = _GeneEscaper()
      for rxn, rule in iteritems(get_compiled_gene_reaction_rules(cobra_model)):
          if rule is not None:
              rxn._gene_reaction_rule = ast2str(gene_renamer.visit(rule))
docs: makes all ids SBML compliant