import json


def iterate_dict(dictionary, parents=[]):
    """
    This function iterates over one dict and returns a list of tuples: (list_of_keys, value)
    Usefull for looping through a multidimensional dictionary.
    """

    ret = []
    for key, value in dictionary.items():
        if isinstance(value, dict):
            ret.extend(iterate_dict(value, parents + [key]))
        elif isinstance(value, list):
            ret.append((parents + [key], json.dumps(value)))
        else:
            ret.append((parents + [key], value))
    return ret