def METHOD_NAME(online_instances, local_instances):
    diff_insts = set(local_instances) - set(online_instances.keys())
    instance_id_list = [local_instances[key].get('id') for key in diff_insts]
    InstanceConfig.objects.filter(id__in=instance_id_list).exclude(oper_type=constants.REBUILD_INSTANCE).update(
        is_deleted=True, deleted_time=timezone.now()
    )