code: def stoichiometry_matrix(metabolites, reactions):
      
      matrix = np.zeros((len(metabolites), len(reactions)))
      met_index = dict((met, i) for i, met in enumerate(metabolites))
      rxn_index = dict()
      for i, rxn in enumerate(reactions):
          rxn_index[rxn] = i
          for met, coef in iteritems(rxn.metabolites):
              j = met_index[met]
              matrix[j, i] = coef
      return matrix, met_index, rxn_index
docs: Return the stoichiometry matrix representation of a set of reactions.
  
      The reactions and metabolites order is respected. All metabolites are
      expected to be contained and complete in terms of the reactions.
  
      Parameters
      ----------
      reactions : iterable
          A somehow ordered list of unique reactions.
      metabolites : iterable
          A somehow ordered list of unique metabolites.
  
      Returns
      -------
      numpy.array
          The 2D array that represents the stoichiometry matrix.
      dict
          A dictionary mapping metabolites to row indexes.
      dict
          A dictionary mapping reactions to column indexes.