Recursively apply a function to all dicts in a nested dictionary

    :param f: Function to apply
    :param data: Dictionary (possibly nested) to recursively apply
    function to
    :return:

def walk_recursive(f, data):
    """
    Recursively apply a function to all dicts in a nested dictionary

    :param f: Function to apply
    :param data: Dictionary (possibly nested) to recursively apply
    function to
    :return:
    """
    results = {}
    if isinstance(data, list):
        return [walk_recursive(f, d) for d in data]
    elif isinstance(data, dict):
        results = funcy.walk_keys(f, data)

        for k, v in data.iteritems():
            if isinstance(v, dict):
                results[f(k)] = walk_recursive(f, v)
            elif isinstance(v, list):
                results[f(k)] = [walk_recursive(f, d) for d in v]
    else:
        return f(data)

    return results