def clean_hostlist(args):
 hosts = []
 networks = []
 for i in args:
  if any((c.isalpha() for c in i)):
   i = i.split('/')[0]
   hosts.append(i)
  elif ('/' in i):
   networks.append(netaddr.IPNetwork(i))
  else:
   hosts.append(i)
 result = []
 for network in networks:
  if (network.size >= opts.threads):
   result.append(network)
  else:
   for i in network:
    hosts.append(str(i))
 if hosts:
  result.append(hosts)
 return result

def clean_hostlist ( args ) : hosts = [ ] networks = [ ] for i in args : if any ( ( c . isalpha ( ) for c in i ) ) : i = i . split ( '/' ) [ 0 ] hosts . append ( i ) elif ( '/' in i ) : networks . append ( netaddr . IPNetwork ( i ) ) else : hosts . append ( i ) result = [ ] for network in networks : if ( network . size >= opts . threads ) : result . append ( network ) else : for i in network : hosts . append ( str ( i ) ) if hosts : result . append ( hosts ) return result
returns list of iterables examples: .