def domain_xml(identifier, xml, mounts, network_name=None):
    """Fills the XML file with the required fields.

    @param identifier: (str) UUID of the Environment.
    @param xml: (str) XML configuration of the domain.
    @param filesystem: (tuple) ((source, target), (source, target))

     * name
     * uuid
     * devices
     * network
     * filesystem

    """
    domain = etree.fromstring(xml)

    subelement(domain, './/name', 'name', identifier)
    subelement(domain, './/uuid', 'uuid', identifier)
    devices = subelement(domain, './/devices', 'devices', None)

    for mount in mounts:
        filesystem = etree.SubElement(devices, 'filesystem', type='mount')
        etree.SubElement(filesystem, 'source', dir=mount[0])
        etree.SubElement(filesystem, 'target', dir=mount[1])

    if network_name is not None:
        network = subelement(devices, './/interface[@type="network"]', 'interface', None, type='network')
        subelement(network, './/source', 'source', None, network=network_name)

    return etree.tostring(domain).decode('utf-8')
Fills the XML file with the required fields.

    @param identifier: (str) UUID of the Environment.
    @param xml: (str) XML configuration of the domain.
    @param filesystem: (tuple) ((source, target), (source, target))

     * name
     * uuid
     * devices
     * network
     * filesystem