code: def promptsmaker(prompts, batch):
      out_p = []
      plen = len(prompts)
      for prompt in prompts:
          add = ""
          if KCOMM in prompt:
              add, prompt = prompt.split(KCOMM)
              add = add + " "
          prompts = prompt.split(KBRK)
          out_p.append([add + p for p in prompts])
      out = [None] * batch * len(out_p[0]) * len(out_p)
      for p, prs in enumerate(out_p):  # inputs prompts
          for r, pr in enumerate(prs):  # prompts for regions
              start = (p + r * plen) * batch
              out[start : start + batch] = [
                  pr
              ] * batch  # P1R1B1,P1R1B2...,P1R2B1,P1R2B2...,P2R1B1...
      return out, out_p
  
imports: import math
  from typing import Dict, Optional
  import torch
  import torchvision.transforms.functional
  from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer
  from diffusers import StableDiffusionPipeline
  from diffusers.models import AutoencoderKL, UNet2DConditionModel
  from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
  from diffusers.schedulers import KarrasDiffusionSchedulers
  from diffusers.utils import USE_PEFT_BACKEND
label_desc: Use image node_id 1 for calling a global function with example usage: promptsmaker(prompts, batch) and returns: out,  out_p