def generate(parent, child_name, template, description, name, tags):
    """
    A recursive function that traverses the "tree" in a dict to create new
    namespaces and/or tags as required.

    Populates the "tags" dict with tag_value instances so it's possible to
    generate FOM Object based classes based on the newly created tags.
    """
    # Create the child namespace
    if child_name:
        ns = make_namespace('/'.join([parent.path, child_name]), name, description)
    else:
        ns = parent

    for key, value in template.iteritems():
        # drop all the white space
        key = key.strip()
        # lets see what's in here
        if isinstance(value, dict):
            # ok... we have another dict, so we're doing depth first traversal
            # and jump right in
            generate(ns, key, value, description, name, tags)
        else:
            # it must be a tag so create the tag within the current namespace
            tag = make_tag(ns, key, description, False)
            # Create the tag_value instance...
            # Lets make sure we specify the right sort of mime
            defaultType = None
            if isinstance(value, list) and not all(isinstance(x, basestring) for
                                                 x in value):
                defaultType = 'application/json'
                logger.info("Found list that's not all strings, setting JSON tag value "
                            "with MIME type %r" % defaultType)
            attribute_name = tag.path
            logger.info((tag.path, attribute_name) % 'Mapping tag: %r to attribute: %r')
            tags[attribute_name] = tag_value(tag.path, defaultType)
dataset/ETHPy150Open fluidinfo/flimp/flimp/utils.py/generate/swapped operands of `%`