def nthhost(value, query=''):
 try:
  vtype = ipaddr(value, 'type')
  if (vtype == 'address'):
   v = ipaddr(value, 'cidr')
  elif (vtype == 'network'):
   v = ipaddr(value, 'subnet')
  value = netaddr.IPNetwork(v)
 except:
  return False
 if (not query):
  return False
 try:
  nth = int(query)
  if (value.size > nth):
   return value[nth]
 except ValueError:
  return False
 return False

def nthhost ( value , query = '' ) : try : vtype = ipaddr ( value , 'type' ) if ( vtype == 'address' ) : v = ipaddr ( value , 'cidr' ) elif ( vtype == 'network' ) : v = ipaddr ( value , 'subnet' ) value = netaddr . IPNetwork ( v ) except : return False if ( not query ) : return False try : nth = int ( query ) if ( value . size > nth ) : return value [ nth ] except ValueError : return False return False
get the nth host within a given network .