code: def save_xml(xml_str, file_name, pretty=True):
      
      try:
          fh = open(file_name, 'wt')
      except IOError:
          logger.error('Could not open %s for writing.' % file_name)
          return
      if pretty:
          xmld = xml.dom.minidom.parseString(xml_str)
          xml_str_pretty = xmld.toprettyxml()
          fh.write(xml_str_pretty)
      else:
          fh.write(xml_str)
      fh.close()
docs: Save the TRIPS EKB XML in a file.
  
      Parameters
      ----------
      xml_str : str
          The TRIPS EKB XML string to be saved.
      file_name : str
          The name of the file to save the result in.
      pretty : Optional[bool]
          If True, the XML is pretty printed.