code: def model_reaction_limits(model):
      
      for reaction in sorted(model.reactions, key=lambda r: r.id):
          equation = reaction.properties.get('equation')
          if equation is None:
              continue
  
          # Determine the default flux limits. If the value is already at the
          # default it does not need to be included in the output.
          lower_default, upper_default = None, None
          if model.default_flux_limit is not None:
              if equation.direction.reverse:
                  lower_default = -model.default_flux_limit
              else:
                  lower_default = 0.0
  
              if equation.direction.forward:
                  upper_default = model.default_flux_limit
              else:
                  upper_default = 0.0
  
          lower_flux, upper_flux = None, None
          if reaction.id in model.limits:
              _, lower, upper = model.limits[reaction.id]
              lower_flux = _get_output_limit(lower, lower_default)
              upper_flux = _get_output_limit(upper, upper_default)
  
          if lower_flux is not None or upper_flux is not None:
              d = OrderedDict([('reaction', reaction.id)])
              d.update(_generate_limit_items(lower_flux, upper_flux))
  
              yield d
docs: Yield model reaction limits as YAML dicts.