def format(self, info_dict, delimiter='<STR_LIT:/>'):
def dfs(father, path, acc):<EOL><INDENT>if isinstance(father, list):<EOL><INDENT>for child in father:<EOL><INDENT>dfs(child, path, acc)<EOL><DEDENT><DEDENT>elif isinstance(father, collections.Mapping):<EOL><INDENT>for child in sorted(father.items(), key=itemgetter(<NUM_LIT:0>)), :<EOL><INDENT>dfs(child, path, acc)<EOL><DEDENT><DEDENT>elif isinstance(father, tuple):<EOL><INDENT>path = copy.copy(path)<EOL>path.append(father[<NUM_LIT:0>])<EOL>dfs(father[<NUM_LIT:1>], path, acc)<EOL><DEDENT>else:<EOL><INDENT>path[-<NUM_LIT:1>] = '<STR_LIT>'.format(path[-<NUM_LIT:1>], str(father))<EOL>acc.append(delimiter.join(path))<EOL><DEDENT><DEDENT>result = []<EOL>dfs(info_dict.get('<STR_LIT>') or info_dict, [], result)<EOL>return '<STR_LIT:\n>'.join(result)<EOL>
This formatter will take a data structure that
represent a tree and will print all the paths
from the root to the leaves

in our case it will print each value and the keys
that needed to get to it, for example:

vm0:
    net: lago
    memory: 1024

will be output as:

vm0/net/lago
vm0/memory/1024

    Args:
        info_dict (dict): information to reformat
        delimiter (str): a delimiter for the path components
    Returns:
        str: String representing the formatted info