def replace_nones_in_dict(target, replace_value):
    """Recursively replaces Nones in a dictionary with the given value."""
    for k in target:
        if target[k] is None:
            target[k] = replace_value
        elif type(target[k]) is list:
            result = []
            for e in target[k]:
                if type(e) is dict:
                    result.append(replace_nones_in_dict(e, replace_value))
                else:
                    if e is None:
                        result.append(replace_value)
                    else:
                        result.append(e)
            target[k] = result
        elif type(target[k]) is dict:
            replace_nones_in_dict(target[k], replace_value)
    return target