def parse_exchange(self):
        """Yield tuples of exchange compounds.

        Each exchange compound is a tuple of compound, reaction ID, lower and
        upper flux limits.
        """

        if 'media' in self._model:
            if 'exchange' in self._model:
                raise ParseError('Both "media" and "exchange" are specified')
            logger.warning(
                'The "media" key is deprecated! Please use "exchange" instead:'
                ' https://psamm.readthedocs.io/en/stable/file_format.html')
            exchange_list = self._model['media']
        else:
            exchange_list = self._model.get('exchange')

        extracellular = self.extracellular_compartment
        if exchange_list is not None:
            if not isinstance(exchange_list, list):
                raise ParseError('Expected "exchange" to be a list')

            for exchange_compound in parse_exchange_list(
                    self._context, exchange_list, extracellular):
                compound, reaction_id, lower, upper = exchange_compound
                if compound.compartment is None:
                    compound = compound.in_compartment(extracellular)
                yield compound, reaction_id, lower, upper
Yield tuples of exchange compounds.

        Each exchange compound is a tuple of compound, reaction ID, lower and
        upper flux limits.