<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_timer_key(self, key, tstamp, stack, pickled=False):
 """Append the plain text graphite :param str key: The timer key to process :param int tstamp: The timestamp for the data point :param list stack: The stack of metrics to append the output to """

        self.timers[key].sort()
        values = {'count': len(self.timers[key]),
                  'low': min(self.timers[key]),
                  'high': max(self.timers[key]),
                  'total': sum(self.timers[key])}
        values['mean'] = values['low']
        nth_percentile = 'upper_%i' % self.pct_threshold
        values[nth_percentile] = values['high']

        if values['count']:
            threshold_idx = int(self.threshold_numerator * values['count']) - 1
            values[nth_percentile] = self.timers[key][threshold_idx]
            values['mean'] = float(values['total']) / float(values['count'])

        for metric in values:
            if pickled:
                stack.append(("%s.%s.%s" % (self.timer_prefix, key, metric),
                              (tstamp, values[metric])))
            else:
                stack.append("%s.%s.%s %s %s\n" % (self.timer_prefix,
                                                   key,
                                                   metric,
                                                   values[metric],
                                                   tstamp))