code: def etd_ms_dict2xmlfile(filename, metadata_dict):
      
      try:
          f = open(filename, 'w')
          f.write(generate_etd_ms_xml(metadata_dict).encode("utf-8"))
          f.close()
      except:
          raise MetadataGeneratorException(
              'Failed to create an XML file. Filename: %s' % (filename)
          )
docs: Create an ETD MS XML file.