'Yield (title, scalars, collections) for each namespace.'

def get_namespaces(self):

    s = extrapolate_statistics(logging.statistics)
    for (title, ns) in sorted(s.items()):
        scalars = []
        collections = []
        ns_fmt = self.formatting.get(title, {})
        for (k, v) in sorted(ns.items()):
            fmt = ns_fmt.get(k, {})
            if isinstance(v, dict):
                (headers, subrows) = self.get_dict_collection(v, fmt)
                collections.append((k, (['ID'] + headers), subrows))
            elif isinstance(v, (list, tuple)):
                (headers, subrows) = self.get_list_collection(v, fmt)
                collections.append((k, headers, subrows))
            else:
                format = ns_fmt.get(k, missing)
                if (format is None):
                    continue
                if hasattr(format, '__call__'):
                    v = format(v)
                elif (format is not missing):
                    v = (format % v)
                scalars.append((k, v))
        (yield (title, scalars, collections))
