def update_nested_dict(main_dict, new_dict):
    """Update nested dict (only level of nesting) with new values.


    Unlike dict.update, this assumes that the values of the parent dict are
    dicts, so you shouldn't replace the nested dict if it already exists.
    Instead you should update the sub-dict.
    """
    # update named styles specified by user
    for name, rc_dict in new_dict.iteritems():
        if name in main_dict:
            main_dict[name].update(rc_dict)
        else:
            main_dict[name] = rc_dict
    return main_dict