human
Complete this python program:
def _test_parse_factory(source, count):
assistant
#Here is the Python program you requested.

    """Generate a test method for parse()ing the given source.
    The generated function extracts each phylogenetic tree using the parse()
    function and counts the total number of trees extracted.
    """
    fname = os.path.basename(source)
    def test_parse(self):
        trees = PhyloXMLIO.parse(source)
        self.assertEqual(len(list(trees)), count)
    test_parse.__doc__ = ('Parse    the    phylogenies    in    %s.' % fname)
    return test_parse