'Writes a dnsmasq compatible additional hosts file.
The generated file is sent to the --addn-hosts option of dnsmasq,
and lists the hosts on the network which should be resolved even if
the dnsmasq instance did not give a lease to the host (see the
`_output_hosts_file` method).
Each line in this file is in the same form as a standard /etc/hosts
file.'

def _output_addn_hosts_file(self):

    buf = six.StringIO()
    for host_tuple in self._iter_hosts():
        (port, alloc, hostname, fqdn, no_dhcp, no_opts) = host_tuple
        if alloc:
            buf.write(('%s DCTB %s    %s\n' % (alloc.ip_address, fqdn, hostname)))
    addn_hosts = self.get_conf_file_name('addn_hosts')
    file_utils.replace_file(addn_hosts, buf.getvalue())
    return addn_hosts
