Find changes in ansible return data

def _changes(plays):
    '''
    Find changes in ansible return data
    '''
    changes = {}
    for play in plays['plays']:
        task_changes = {}
        for task in play['tasks']:
            host_changes = {}
            for host, data in six.iteritems(task['hosts']):
                if data['changed'] is True:
                    host_changes[host] = data.get('diff', data.get('changes', {}))
            if host_changes:
                task_changes[task['task']['name']] = host_changes
        if task_changes:
            changes[play['play']['name']] = task_changes
    return changes