<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_note(note, **kwargs):
 """ Update a note """

    note_i = _get_note(note.id)

    if note.ref_key != note_i.ref_key:
        raise HydraError("Cannot convert a %s note to a %s note. Please create a new note instead."%(note_i.ref_key, note.ref_key))

    note_i.set_ref(note.ref_key, note.ref_id)

    note_i.value = note.value

    db.DBSession.flush()

    return note_i