def _getinfos_dns(spec):
 infos = {}
 fullinfos = {}
 fields = {'domain': 'value', 'domaintarget': 'targetval'}
 for field in fields:
  try:
   if (fields[field] not in spec):
    continue
   infos[field] = []
   fullinfos[field] = []
   for domain in utils.get_domains(spec.get(('full' + fields[field]), spec[fields[field]])):
    infos[field].append(domain[:utils.MAXVALLEN])
    if (len(domain) > utils.MAXVALLEN):
     fullinfos[field].append(domain)
   if (not infos[field]):
    del infos[field]
   if (not fullinfos[field]):
    del fullinfos[field]
  except Exception:
   pass
 res = {}
 if infos:
  res['infos'] = infos
 if fullinfos:
  res['fullinfos'] = fullinfos
 return res

def _getinfos_dns ( spec ) : infos = { } fullinfos = { } fields = { 'domain' : 'value' , 'domaintarget' : 'targetval' } for field in fields : try : if ( fields [ field ] not in spec ) : continue infos [ field ] = [ ] fullinfos [ field ] = [ ] for domain in utils . get_domains ( spec . get ( ( 'full' + fields [ field ] ) , spec [ fields [ field ] ] ) ) : infos [ field ] . append ( domain [ : utils . MAXVALLEN ] ) if ( len ( domain ) > utils . MAXVALLEN ) : fullinfos [ field ] . append ( domain ) if ( not infos [ field ] ) : del infos [ field ] if ( not fullinfos [ field ] ) : del fullinfos [ field ] except Exception : pass res = { } if infos : res [ 'infos' ] = infos if fullinfos : res [ 'fullinfos' ] = fullinfos return res
extract domain names in an handy-to-index-and-query form .