code: def save_embedding(
      embedding,
      optimizer,
      checkpoint,
      embedding_name,
      filename,
      remove_cached_checksum=True,
  ):
      old_embedding_name = embedding.name
      old_sd_checkpoint = (
          embedding.sd_checkpoint
          if hasattr(embedding, "sd_checkpoint")
          else None
      )
      old_sd_checkpoint_name = (
          embedding.sd_checkpoint_name
          if hasattr(embedding, "sd_checkpoint_name")
          else None
      )
      old_cached_checksum = (
          embedding.cached_checksum
          if hasattr(embedding, "cached_checksum")
          else None
      )
      try:
          embedding.sd_checkpoint = checkpoint.shorthash
          embedding.sd_checkpoint_name = checkpoint.model_name
          if remove_cached_checksum:
              embedding.cached_checksum = None
          embedding.name = embedding_name
          embedding.optimizer_state_dict = optimizer.state_dict()
          embedding.save(filename)
      except:
          embedding.sd_checkpoint = old_sd_checkpoint
          embedding.sd_checkpoint_name = old_sd_checkpoint_name
          embedding.name = old_embedding_name
          embedding.cached_checksum = old_cached_checksum
          raise
  
imports: import os
  from collections import namedtuple
  from contextlib import closing
  import torch
  import tqdm
  import html
  import datetime
  import csv
  import safetensors.torch
  import numpy
  from PIL import Image, PngImagePlugin
  from torch.utils.tensorboard import SummaryWriter
  from modules import shared, devices, sd_hijack, sd_models, images, sd_samplers, sd_hijack_checkpoint, errors, hashes
  import modules.textual_inversion.dataset
  from modules.textual_inversion.learn_schedule import LearnRateScheduler
  from modules.textual_inversion.image_embedding import embedding_to_b64, embedding_from_b64, insert_image_data_embed, extract_image_data_embed, caption_image_overlay
  from modules.textual_inversion.logging import save_settings_to_file
label_desc: Use image node_id 11 for calling a global function with example usage: save_embedding(embedding, optimizer, checkpoint, embedding_name, filename, remove_cached_checksum) without return types