def __split_models(self, xmlDoc): """generator that takes parameter xmlDoc and splits it into many xml files, with only one model per each""" elem = XML(xmlDoc) models = elem.find("Models") if models: elem.remove(models) for model in models: to_return = copy.deepcopy(elem) new_models = Element("Models") for a in models.attrib: new_models.attrib[a] = models.attrib[a] new_models.append(model) to_return.append(new_models) yield (model.attrib['id'], to_return) else: pass #TODO return error