<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _setup_stats_status_codes(self, spider_name):
        '''
        Sets up the status code stats collectors
        '''
        self.stats_dict[spider_name] = {
            'status_codes': {}
        }
        self.stats_dict[spider_name]['status_codes'] = {}
        hostname = self._get_hostname()
        # we chose to handle 504's here as well as in the middleware
        # in case the middleware is disabled
        for status_code in self.settings['STATS_RESPONSE_CODES']:
            temp_key = 'stats:crawler:{h}:{n}:{s}'.format(
                h=hostname, n=spider_name, s=status_code)
            self.stats_dict[spider_name]['status_codes'][status_code] = {}
            for item in self.settings['STATS_TIMES']:
                try:
                    time = getattr(StatsCollector, item)

                    self.stats_dict[spider_name]['status_codes'][status_code][time] = StatsCollector \
                            .get_rolling_time_window(
                                    redis_conn=self.redis_conn,
                                    key='{k}:{t}'.format(k=temp_key, t=time),
                                    window=time,
                                    cycle_time=self.settings['STATS_CYCLE'])
                    self.logger.debug("Set up status code {s}, {n} spider,"\
                        " host {h} Stats Collector '{i}'"\
                        .format(h=hostname, n=spider_name, s=status_code, i=item))
                except AttributeError as e:
                    self.logger.warning("Unable to find Stats Time '{s}'"\
                            .format(s=item))
            total = StatsCollector.get_hll_counter(redis_conn=self.redis_conn,
                            key='{k}:lifetime'.format(k=temp_key),
                            cycle_time=self.settings['STATS_CYCLE'],
                            roll=False)
            self.logger.debug("Set up status code {s}, {n} spider,"\
                        "host {h} Stats Collector 'lifetime'"\
                            .format(h=hostname, n=spider_name, s=status_code))
            self.stats_dict[spider_name]['status_codes'][status_code]['lifetime'] = total