code: def prepare_image(pil_image):
      arr = np.array(pil_image.convert("RGB"))
      arr = arr.astype(np.float32) / 127.5 - 1
      arr = np.transpose(arr, [2, 0, 1])
      image = torch.from_numpy(arr).unsqueeze(0)
      return image
  
imports: import inspect
  from typing import Callable, Dict, List, Optional, Union
  import numpy
  import PIL
  import PIL.Image
  import torch
  from transformers import T5EncoderModel, T5Tokenizer
  from ...loaders import LoraLoaderMixin
  from ...models import Kandinsky3UNet, VQModel
  from ...schedulers import DDPMScheduler
  from ...utils import deprecate, is_accelerate_available, logging, replace_example_docstring
  from ...utils.torch_utils import randn_tensor
  from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput
label_desc: Use image node_id 2 for calling a global function with example usage: prepare_image(pil_image) and returns: image