code: def put_watermark(img, wm_encoder=None):
      if wm_encoder is not None:
          img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
          img = wm_encoder.encode(img, "dwtDct")
          img = Image.fromarray(img[:, :, ::-1])
      return img
  
imports: import argparse
  import os
  from itertools import islice
  import cv2
  import numpy
  import torch
  from einops import rearrange
  from omegaconf import OmegaConf
  from PIL import Image
  from torchvision.utils import make_grid
  from tqdm import tqdm, trange
  from contextlib import nullcontext
  from imwatermark import WatermarkEncoder
  from ldm.models.diffusion.ddim import DDIMSampler
  from ldm.models.diffusion.dpm_solver import DPMSolverSampler
  from ldm.models.diffusion.plms import PLMSSampler
  from ldm.util import instantiate_from_config
  from torch import autocast
  from utils import replace_module
label_desc: Use image node_id 4 for calling a global function with example usage: put_watermark(img, wm_encoder) and returns: img