def save(self, targetFile=None):
    root = self.genXML()
    self.appendObjects(root)
    out_file = None
    if (targetFile is None):
        out_file = codecs.open((self.filename + XML_EXT), 'w', encoding=ENCODE_METHOD)
    else:
        out_file = codecs.open(targetFile, 'w', encoding=ENCODE_METHOD)
    prettifyResult = self.prettify(root)
    out_file.write(prettifyResult.decode('utf8'))
    out_file.close()
def save(self, targetFile=None):
    root = self.genXML()
    self.appendObjects(root)
    out_file = None
    if (targetFile is None):
        out_file = codecs.open((self.filename + XML_EXT), 'w', encoding=ENCODE_METHOD)
    else:
        out_file = codecs.open(targetFile, 'w', encoding=ENCODE_METHOD)
    prettifyResult = self.prettify(root)
    out_file.write(prettifyResult.decode('utf8'))
    out_file.close()