code: def check_stoichiometric_consistency(model):
      
      problem = model.problem
      # The transpose of the stoichiometric matrix N.T in the paper.
      stoich_trans = problem.Model()
      internal_rxns = con_helpers.get_internals(model)
      metabolites = set(met for rxn in internal_rxns for met in rxn.metabolites)
      LOGGER.info("model '%s' has %d internal reactions", model.id,
                  len(internal_rxns))
      LOGGER.info("model '%s' has %d internal metabolites", model.id,
                  len(metabolites))
  
      stoich_trans.add([problem.Variable(m.id, lb=1) for m in metabolites])
      stoich_trans.update()
      con_helpers.add_reaction_constraints(
          stoich_trans, internal_rxns, problem.Constraint)
      # The objective is to minimize the metabolite mass vector.
      stoich_trans.objective = problem.Objective(
          Zero, direction="min", sloppy=True)
      stoich_trans.objective.set_linear_coefficients(
          {var: 1. for var in stoich_trans.variables})
      status = stoich_trans.optimize()
      if status == OPTIMAL:
          return True
      elif status == INFEASIBLE:
          return False
      else:
          raise RuntimeError(
              "Could not determine stoichiometric consistencty."
              " Solver status is '{}'"
              " (only optimal or infeasible expected).".format(status))
docs: Verify the consistency of the model's stoichiometry.
  
      Parameters
      ----------
      model : cobra.Model
          The metabolic model under investigation.
  
      Notes
      -----
      See [1]_ section 3.1 for a complete description of the algorithm.
  
      .. [1] Gevorgyan, A., M. G Poolman, and D. A Fell.
             "Detection of Stoichiometric Inconsistencies in Biomolecular
             Models."
             Bioinformatics 24, no. 19 (2008): 2245.