code: def total_flux(F, A=None):
      r
      if A is None:
          prod = flux_production(F)
          zeros = np.zeros(len(prod))
          outflux = np.sum(np.maximum(prod, zeros))
          return outflux
      else:
          X = set(np.arange(F.shape[0]))  # total state space
          A = set(A)
          notA = X.difference(A)
          outflux = (F[list(A), :])[:, list(notA)].sum()
          return outflux
docs: r"""Compute the total flux, or turnover flux, that is produced by the
          flux sources and consumed by the flux sinks
  
      Parameters
      ----------
      F : (n, n) ndarray
          Matrix of flux values between pairs of states.
      A : array_like (optional)
          List of integer state labels for set A (reactant)
  
      Returns
      -------
      F : float
          The total flux, or turnover flux, that is produced by the
          flux sources and consumed by the flux sinks