<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def diff_result_to_cell(item):
    '''diff.diff returns a dictionary with all the information we need,
    but we want to extract the cell and change its metadata.'''
    state = item['state']
    if state == 'modified':
        new_cell = item['modifiedvalue'].data
        old_cell = item['originalvalue'].data
        new_cell['metadata']['state'] = state
        new_cell['metadata']['original'] = old_cell
        cell = new_cell
    else:
        cell = item['value'].data
        cell['metadata']['state'] = state
    return cell