<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def tarfile_xml_generator(fname):
 """ Generator for iterating through xml files in a tarball. Returns strings. Example usage:: xmlgen = tarfile_xml_generator(fname) xml0 = next(xmlgen) for pkt in xmlgen: foo(pkt) """

    tf = tarfile.open(fname, mode='r')
    try:
        tarinf = tf.next()
        while tarinf is not None:
            if tarinf.isfile() and tarinf.name[-4:] == '.xml':
                fbuf = tf.extractfile(tarinf)
                yield TarXML(name=tarinf.name, xml=fbuf.read())
            tarinf = tf.next()
            # Kludge around tarfile memory leak, cf
            # http://blogs.it.ox.ac.uk/inapickle/2011/06/20/high-memory-usage-when-using-pythons-tarfile-module/
            tf.members = []
    finally:
        tf.close()