'Persist the current in-memory list of config_elems to a file named by the value
of config_filename.'

def data_manager_config_elems_to_xml_file(self, config_elems, config_filename):

    data_managers_path = self.data_managers_path
    lock = threading.Lock()
    lock.acquire(True)
    try:
        fh = open(config_filename, 'wb')
        if (data_managers_path is not None):
            fh.write(('<?xml    version="1.0"?>\n<data_managers    tool_path="%s">\n                ' % data_managers_path))
        else:
            fh.write('<?xml    version="1.0"?>\n<data_managers>\n                ')
        for elem in config_elems:
            fh.write(xml_util.xml_to_string(elem))
        fh.write('</data_managers>\n')
        fh.close()
    except Exception:
        log.exception('Exception    in    DataManagerHandler.data_manager_config_elems_to_xml_file')
    finally:
        lock.release()
