class SpamExtractor(sax.ContentHandler):

    def __init__(self, canning_machine):
        self.canning_machine = canning_machine

def startElement(self, name, attrs):
    if name == 'spam':
        print('We found a spam!')
self.canning_machine.can(name, attrs)
Как вернуть данные из парсера Python SAX?