<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def summary(self, raw):
 """ Return one taxonomy summarizing the reported tags If there is only one tag, use it as the predicate If there are multiple tags, use "entries" as the predicate Use the total count as the value Use the most malicious level found Examples: Input { "name": SCANNER1, "intention": "" } Output GreyNoise:SCANNER1 = 1 (info) Input { "name": SCANNER1, "intention": "malicious" }, { "name": SCANNER1, "intention": "benign" } Output GreyNoise:SCANNER1 = 2 (malicious) Input { "name": SCANNER1, "intention": "" }, { "name": SCANNER1, "intention": "safe" }, { "name": SCANNER2, "intention": "" } Output GreyNoise:entries = 3 (safe) """


        try:
            taxonomies = []
            if raw.get('records'):
                final_level = None
                taxonomy_data = defaultdict(int)
                for record in raw.get('records', []):
                    name = record.get('name', 'unknown')
                    intention = record.get('intention', 'unknown')
                    taxonomy_data[name] += 1
                    final_level = self._get_level(final_level, intention)

                if len(taxonomy_data) > 1:  # Multiple tags have been found
                    taxonomies.append(self.build_taxonomy(final_level, 'GreyNoise', 'entries', len(taxonomy_data)))
                else:  # There is only one tag found, possibly multiple times
                    for name, count in taxonomy_data.iteritems():
                        taxonomies.append(self.build_taxonomy(final_level, 'GreyNoise', name, count))

            else:
                taxonomies.append(self.build_taxonomy('info', 'GreyNoise', 'Records', 'None'))

            return {"taxonomies": taxonomies}

        except Exception as e:
            self.error('Summary failed\n{}'.format(e.message))