+ Res = l.search_s(HostBaseDn, ldap.SCOPE_SUBTREE, '(objectClass=debianServer)', ['hostname'] )
+ # Res is a list of tuples.
+ # The tuples contain a dn (str) and a dictionary.
+ # The dictionaries map the key "hostname" to a list.
+ # These lists contain a single hostname (str).
+ ValidHostNames = reduce(lambda a,b: a+b, [value.get("hostname", []) for (dn, value) in Res], [])
+