<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rate_slack(self, max_rate):
 """ The maximum time interval that can be stolen to this fragment while keeping it respecting the given max rate. For ``REGULAR`` fragments this value is the opposite of the ``rate_lack``. For ``NONSPEECH`` fragments this value is equal to the length of the fragment. For ``HEAD`` and ``TAIL`` fragments this value is ``0.000``, meaning that they cannot be stolen. :param max_rate: the maximum rate (characters/second) :type max_rate: :class:`~aeneas.exacttiming.Decimal` :rtype: :class:`~aeneas.exacttiming.TimeValue` .. versionadded:: 1.7.0 """

        if self.fragment_type == self.REGULAR:
            return -self.rate_lack(max_rate)
        elif self.fragment_type == self.NONSPEECH:
            return self.length
        else:
            return TimeValue("0.000")