<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(self, tag=None, output=None, **kwargs):
 """ runs the extractor Args: ----- output: ['filepath', None] """

        start = datetime.datetime.now()
        count = 0
        if tag:
            tag = Uri(tag)
            xml_generator = etree.iterparse(self.source,
                                            #events=("start", "end"),
                                            tag=tag.etree)
        else:
            xml_generator = etree.iterparse(self.source) #,
                                            #events=("start", "end"))
        i = 0
        for event, element in xml_generator:
            type_tags = element.findall(_RDF_TYPE_TAG)
            rdf_types = [el.get(_RES_TAG)
                         for el in type_tags
                         if el.get(_RES_TAG)]
            # print(rdf_types)
            if str(self.filter_val) in rdf_types:
                pdb.set_trace()
                # print("%s - %s - %s - %s" % (event,
                #                              element.tag,
                #                              element.attrib,
                #                              element.text))
                count += 1
            # if i == 100:
            #     break
            i += 1
            element.clear()
        print("Found '{}' items in {}".format(count,
                (datetime.datetime.now() - start)))