<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_kbt_items(taxonomyfilename, templatefilename, searchwith=""):
 """ Get items from taxonomy file using a templatefile. If searchwith is defined, return only items that match with it. :param taxonomyfilename: full path+name of the RDF file :param templatefile: full path+name of the XSLT file :param searchwith: a term to search with """

    if processor_type == 1:
        # lxml
        doc = etree.XML(taxonomyfilename)
        styledoc = etree.XML(templatefilename)
        style = etree.XSLT(styledoc)
        result = style(doc)
        strres = str(result)
        del result
        del style
        del styledoc
        del doc
    elif processor_type == 2:
        # libxml2 & libxslt
        styledoc = libxml2.parseFile(templatefilename)
        style = libxslt.parseStylesheetDoc(styledoc)
        doc = libxml2.parseFile(taxonomyfilename)
        result = style.applyStylesheet(doc, None)
        strres = style.saveResultToString(result)
        style.freeStylesheet()
        doc.freeDoc()
        result.freeDoc()
    else:
        # no xml parser found
        strres = ""

    ritems = []
    if len(strres) == 0:
        return []
    else:
        lines = strres.split("\n")
        for line in lines:
            if searchwith:
                if line.count(searchwith) > 0:
                    ritems.append(line)
            else:
                if len(line) > 0:
                    ritems.append(line)

    return ritems