def name_servers(nameservers, for_item=True):
 if isinstance(nameservers, basestring):
  nameservers = nameservers.strip()
  if (for_item is True):
   if (nameservers in ['<<inherit>>', '']):
    return nameservers
  nameservers = shlex.split(nameservers)
 if isinstance(nameservers, list):
  for ns in nameservers:
   ip_version = netaddr.IPAddress(ns).version
   if (ip_version == 4):
    ipv4_address(ns)
   elif (ip_version == 6):
    ipv6_address(ns)
   else:
    raise CX('Invalid IP address format')
 else:
  raise CX(('Invalid input type %s, expected str or list' % type(nameservers)))
 return nameservers

def name_servers ( nameservers , for_item = True ) : if isinstance ( nameservers , basestring ) : nameservers = nameservers . strip ( ) if ( for_item is True ) : if ( nameservers in [ '<<inherit>>' , '' ] ) : return nameservers nameservers = shlex . split ( nameservers ) if isinstance ( nameservers , list ) : for ns in nameservers : ip_version = netaddr . IPAddress ( ns ) . version if ( ip_version == 4 ) : ipv4_address ( ns ) elif ( ip_version == 6 ) : ipv6_address ( ns ) else : raise CX ( 'Invalid IP address format' ) else : raise CX ( ( 'Invalid input type %s, expected str or list' % type ( nameservers ) ) ) return nameservers
validate nameservers ip addresses .