<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stats_track_duration(self, key):
 """Time around a context and add to the the per-message measurements .. versionadded:: 3.19.0 .. note:: If this method is called when there is not a message being processed, a message will be logged at the ``warning`` level to indicate the value is being dropped. To suppress these warnings, set the :attr:`rejected.consumer.Consumer.IGNORE_OOB_STATS` attribute to :data:`True`. .. code-block:: python :caption: Example Usage class Test(consumer.Consumer):
 @gen.coroutine def process(self):
 with self.stats_track_duration('track-time'):
 yield self._time_consuming_function() :param key: The key for the timing to track :type key: :class:`str` """

        start_time = time.time()
        try:
            yield
        finally:
            self.stats_add_duration(
                key, max(start_time, time.time()) - start_time)