<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def import_blacklist(self, parser):
 """Import blacklist. New entries parsed by 'parser' will be added to the blacklist. :param parser: sorting hat parser """

        blacklist = parser.blacklist

        self.log("Loading blacklist...")
        n = 0

        for entry in blacklist:
            try:
                api.add_to_matching_blacklist(self.db, entry.excluded)
                self.display('load_blacklist.tmpl', entry=entry.excluded)
                n += 1
            except ValueError as e:
                raise RuntimeError(str(e))
            except AlreadyExistsError as e:
                msg = "%s. Not added." % str(e)
                self.warning(msg)

        self.log("%d/%d blacklist entries loaded" % (n, len(blacklist)))