'Export Zone object to the BIND compatible format.
:param zone: Zone to export.
:type  zone: :class:`Zone`
:return: Zone data in BIND compatible format.
:rtype: ``str``'

def export_zone_to_bind_format(self, zone):

    if (zone.type != 'master'):
        raise ValueError('You    can    only    generate    BIND    out    for    master    zones')
    lines = []
    records = zone.list_records()
    records = sorted(records, key=Record._get_numeric_id)
    date = datetime.datetime.now().strftime('%Y-%m-%d    %H:%m:%S')
    values = {'version': __version__, 'date': date}
    lines.append((';    Generated    by    Libcloud    v%(version)s    on    %(date)s' % values))
    lines.append(('$ORIGIN    %(domain)s.' % {'domain': zone.domain}))
    lines.append(('$TTL    %(domain_ttl)s\n' % {'domain_ttl': zone.ttl}))
    for record in records:
        line = self._get_bind_record_line(record=record)
        lines.append(line)
    output = '\n'.join(lines)
    return output
