def parse_host_list(list_of_hosts):
 p = set((m.group(1) for m in re.finditer('\\s*([^,\\s]+)\\s*,?\\s*', list_of_hosts)))
 return p

def parse_host_list ( list_of_hosts ) : p = set ( ( m . group ( 1 ) for m in re . finditer ( '\\s*([^,\\s]+)\\s*,?\\s*' , list_of_hosts ) ) ) return p
parse the comma separated list of hosts .