def _task_update(context, task_ref, values, session=None):
    """Apply supplied dictionary of values to a task object."""
    if 'deleted' not in values:
        values['deleted'] = False
    task_ref.update(values)
    task_ref.save(session=session)
    return task_ref
