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

def vm_updated(name, vm_name, cpu, memory, image, version, interfaces,
               disks, scsi_devices, serial_ports, datacenter, datastore,
               cd_dvd_drives=None, sata_controllers=None,
               advanced_configs=None, power_on=False):
    '''
    Updates a virtual machine configuration if there is a difference between
    the given and deployed configuration.
    '''
    result = {'name': name,
              'result': None,
              'changes': {},
              'comment': ''}

    service_instance = __salt__['vsphere.get_service_instance_via_proxy']()
    current_config = __salt__['vsphere.get_vm_config'](
        vm_name,
        datacenter=datacenter,
        objects=False,
        service_instance=service_instance)

    diffs = __salt__['vsphere.compare_vm_configs'](
        {'name': vm_name,
         'cpu': cpu,
         'memory': memory,
         'image': image,
         'version': version,
         'interfaces': interfaces,
         'disks': disks,
         'scsi_devices': scsi_devices,
         'serial_ports': serial_ports,
         'datacenter': datacenter,
         'datastore': datastore,
         'cd_drives': cd_dvd_drives,
         'sata_controllers': sata_controllers,
         'advanced_configs': advanced_configs},
        current_config)
    if not diffs:
        result.update({
            'result': True,
            'changes': {},
            'comment': 'Virtual machine {0} is already up to date'.format(vm_name)})
        return result

    if __opts__['test']:
        comment = 'State vm_updated will update virtual machine \'{0}\' ' \
                  'in datacenter \'{1}\':\n{2}'.format(vm_name,
                                                       datacenter,
                  '\n'.join([':\n'.join([key, difference.changes_str])
                      for key, difference in six.iteritems(diffs)]))
        result.update({'result': None,
                       'comment': comment})
        __salt__['vsphere.disconnect'](service_instance)
        return result

    try:
        changes = __salt__['vsphere.update_vm'](vm_name, cpu, memory, image,
                                                version, interfaces, disks,
                                                scsi_devices, serial_ports,
                                                datacenter, datastore,
                                                cd_dvd_drives=cd_dvd_drives,
                                                sata_controllers=sata_controllers,
                                                advanced_configs=advanced_configs,
                                                service_instance=service_instance)
    except salt.exceptions.CommandExecutionError as exc:
        log.error('Error: %s', exc)
        if service_instance:
            __salt__['vsphere.disconnect'](service_instance)
        result.update({
            'result': False,
            'comment': six.text_type(exc)})
        return result

    if power_on:
        try:
            __salt__['vsphere.power_on_vm'](vm_name, datacenter)
        except salt.exceptions.VMwarePowerOnError as exc:
            log.error('Error: %s', exc)
            if service_instance:
                __salt__['vsphere.disconnect'](service_instance)
            result.update({
                'result': False,
                'comment': six.text_type(exc)})
            return result
        changes.update({'power_on': True})

    __salt__['vsphere.disconnect'](service_instance)

    result = {'name': name,
              'result': True,
              'changes': changes,
              'comment': 'Virtual machine '
                         '{0} was updated successfully'.format(vm_name)}

    return result