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

def _build_appid_info(self, master, dict):
        '''
        Builds the appid info object

        @param master: the master dict
        @param dict: the dict object received
        @return: the appid info object
        '''
        master['total_crawlids'] = 0
        master['total_pending'] = 0
        master['total_domains'] = 0
        master['crawlids'] = {}
        master['appid'] = dict['appid']
        master['spiderid'] = dict['spiderid']

        # used for finding total count of domains
        domain_dict = {}

        # get all domain queues
        match_string = '{sid}:*:queue'.format(sid=dict['spiderid'])
        for key in self.redis_conn.scan_iter(match=match_string):
            domain = key.split(":")[1]
            sortedDict = self._get_bin(key)

            # now iterate through binned dict
            for score in sortedDict:
                for item in sortedDict[score]:
                    if 'meta' in item:
                        item = item['meta']
                    if item['appid'] == dict['appid']:
                        crawlid = item['crawlid']

                        # add new crawlid to master dict
                        if crawlid not in master['crawlids']:
                            master['crawlids'][crawlid] = {
                                'total': 0,
                                'domains': {},
                                'distinct_domains': 0
                            }

                            if 'expires' in item and item['expires'] != 0:
                                master['crawlids'][crawlid]['expires'] = item['expires']

                            master['total_crawlids'] += 1

                        master['crawlids'][crawlid]['total'] = master['crawlids'][crawlid]['total'] + 1

                        if domain not in master['crawlids'][crawlid]['domains']:
                            master['crawlids'][crawlid]['domains'][domain] = {
                                'total': 0,
                                'high_priority': -9999,
                                'low_priority': 9999,
                            }
                            master['crawlids'][crawlid]['distinct_domains'] += 1
                            domain_dict[domain] = True


                        master['crawlids'][crawlid]['domains'][domain]['total'] = master['crawlids'][crawlid]['domains'][domain]['total'] + 1

                        if item['priority'] > master['crawlids'][crawlid]['domains'][domain]['high_priority']:
                            master['crawlids'][crawlid]['domains'][domain]['high_priority'] = item['priority']

                        if item['priority'] < master['crawlids'][crawlid]['domains'][domain]['low_priority']:
                            master['crawlids'][crawlid]['domains'][domain]['low_priority'] = item['priority']

                        master['total_pending'] += 1

        master['total_domains'] = len(domain_dict)

        return master