'Returns a map of zones and the records that belong
in them'

def __forward_zones(self):

    zones = {}
    forward_zones = self.settings.manage_forward_zones
    if (not isinstance(forward_zones, list)):
        forward_zones = [forward_zones]
    for zone in forward_zones:
        zones[zone] = {}
    for system in self.systems:
        for (name, interface) in system.interfaces.iteritems():
            host = interface['dns_name']
            ip = interface['ip_address']
            ipv6 = interface['ipv6_address']
            ipv6_sec_addrs = interface['ipv6_secondaries']
            if (not system.is_management_supported(cidr_ok=False)):
                continue
            if (not host):
                continue
            if (host.find('.') == (-1)):
                continue
            best_match = ''
            for zone in zones.keys():
                if (re.search(('\\.%s$' % zone), host) and (len(zone) > len(best_match))):
                    best_match = zone
            if (best_match == ''):
                continue
            host = re.sub(('\\.%s$' % best_match), '', host)
            ips = []
            if ip:
                ips.append(ip)
            if ipv6:
                ips.append(ipv6)
            if ipv6_sec_addrs:
                ips += ipv6_sec_addrs
            if ips:
                try:
                    zones[best_match][host] = (ips + zones[best_match][host])
                except KeyError:
                    zones[best_match][host] = ips
    return zones
