def fix_note_noted(json):
    """Ensure the 'noted' flag is set if and only if a note is given"""
    if 'note' in json and json['note']:
        json['noted'] = True
    else:
        del json['note']
        json['noted'] = False        
    return json