def make_flat_dict(name, selector=None, subselector=None,
                   ns=None, colon_ns=False, root=None,
                   ignore_sub_dicts=False):

    # Set up the names we need...
    if ns is None:
        elemname = name
        tagname = Selector(0)
    else:
        elemname = '{%s}%s' % (ns, name)
        tagname = lambda obj, do_raise=False: '{%s}%s' % (ns, obj[0])

    if selector is None:
        selector = name
    if not root:
        # Build the root element
        root = TemplateElement(elemname, selector=selector,
                               subselector=subselector, colon_ns=colon_ns)
    choice = get_items if ignore_sub_dicts is False else get_items_without_dict
    # Build an element to represent all the keys and values
    elem = SubTemplateElement(root, tagname, selector=choice,
                              colon_ns=colon_ns)
    elem.text = 1

    # Return the template
    return root
Tests that the C{as_class} template filter works
dataset/ETHPy150Open openstack/rack/rack/api/xmlutil.py/make_flat_dict--crossover with--dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/permissions/tests/tests.py/TestObjectPermissions.test_as_class