'Format CNAMEs and with consistent indentation'

def __pretty_print_cname_records(self, hosts, rectype='CNAME'):

    s = ''
    for system in self.systems:
        for (name, interface) in system.interfaces.iteritems():
            cnames = interface.get('cnames', [])
            try:
                if (interface.get('dns_name', '') != ''):
                    dnsname = interface['dns_name'].split('.')[0]
                    for cname in cnames:
                        s += ('%s        %s        %s;\n' % (cname.split('.')[0], rectype, dnsname))
                else:
                    self.logger.info(('Warning:    dns_name    unspecified    in    the    system:    %s,    Skipped!,    while    writing    cname    records' % system.name))
                    continue
            except:
                pass
    return s
